diff options
60 files changed, 231 insertions, 216 deletions
@@ -6,6 +6,7 @@ include_rules = [ "+third_party/skia/include", "+third_party/khronos/GLES2/gl2.h", "+third_party/khronos/GLES2/gl2ext.h", + "+ui/base", "+ui/gfx", "+ui/gl", "+ui/surface", @@ -60,8 +60,6 @@ 'debug/fake_web_graphics_context_3d.h', 'debug/frame_rate_counter.cc', 'debug/frame_rate_counter.h', - 'debug/latency_info.cc', - 'debug/latency_info.h', 'debug/layer_tree_debug_state.cc', 'debug/layer_tree_debug_state.h', 'debug/overdraw_metrics.cc', diff --git a/cc/debug/latency_info.cc b/cc/debug/latency_info.cc deleted file mode 100644 index f59b07b..0000000 --- a/cc/debug/latency_info.cc +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "cc/debug/latency_info.h" - -#include <algorithm> - -namespace cc { - -LatencyInfo::LatencyInfo() { -} - -LatencyInfo::~LatencyInfo() { -} - -void LatencyInfo::MergeWith(const LatencyInfo& other) { - for (LatencyMap::const_iterator b = other.latency_components.begin(); - b != other.latency_components.end(); ++b) { - AddLatencyNumberWithTimestamp(b->first.first, b->first.second, - b->second.sequence_number, - b->second.event_time, - b->second.event_count); - } -} - -void LatencyInfo::AddLatencyNumber(LatencyComponentType component, - int64 id, int64 component_sequence_number) { - AddLatencyNumberWithTimestamp(component, id, component_sequence_number, - base::TimeTicks::Now(), 1); -} - -void LatencyInfo::AddLatencyNumberWithTimestamp( - LatencyComponentType component, int64 id, int64 component_sequence_number, - base::TimeTicks time, uint32 event_count) { - LatencyMap::key_type key = std::make_pair(component, id); - LatencyMap::iterator f = latency_components.find(key); - if (f == latency_components.end()) { - LatencyComponent info = {component_sequence_number, time, event_count}; - latency_components[key] = info; - } else { - f->second.sequence_number = std::max(component_sequence_number, - f->second.sequence_number); - uint32 new_count = event_count + f->second.event_count; - if (event_count > 0 && new_count != 0) { - // Do a weighted average, so that the new event_time is the average of - // the times of events currently in this structure with the time passed - // into this method. - f->second.event_time += (time - f->second.event_time) * event_count / - new_count; - f->second.event_count = new_count; - } - } -} - -void LatencyInfo::Clear() { - latency_components.clear(); -} - -} // namespace cc - diff --git a/cc/output/compositor_frame_metadata.h b/cc/output/compositor_frame_metadata.h index 55ee9da..4e569bb 100644 --- a/cc/output/compositor_frame_metadata.h +++ b/cc/output/compositor_frame_metadata.h @@ -6,7 +6,7 @@ #define CC_OUTPUT_COMPOSITOR_FRAME_METADATA_H_ #include "cc/base/cc_export.h" -#include "cc/debug/latency_info.h" +#include "ui/base/latency_info.h" #include "ui/gfx/size_f.h" #include "ui/gfx/vector2d_f.h" @@ -38,7 +38,7 @@ class CC_EXPORT CompositorFrameMetadata { gfx::Vector2dF location_bar_content_translation; float overdraw_bottom_height; - LatencyInfo latency_info; + ui::LatencyInfo latency_info; }; } // namespace cc diff --git a/cc/output/delegating_renderer.cc b/cc/output/delegating_renderer.cc index 3b5839e..ea034b0 100644 --- a/cc/output/delegating_renderer.cc +++ b/cc/output/delegating_renderer.cc @@ -156,7 +156,7 @@ void DelegatingRenderer::DrawFrame( resource_provider_->PrepareSendToParent(resources, &out_data.resource_list); } -void DelegatingRenderer::SwapBuffers(const LatencyInfo& latency_info) { +void DelegatingRenderer::SwapBuffers(const ui::LatencyInfo& latency_info) { TRACE_EVENT0("cc", "DelegatingRenderer::SwapBuffers"); output_surface_->SendFrameToParentCompositor(&frame_for_swap_buffers_); diff --git a/cc/output/delegating_renderer.h b/cc/output/delegating_renderer.h index 6e659c0..ef44f79 100644 --- a/cc/output/delegating_renderer.h +++ b/cc/output/delegating_renderer.h @@ -32,7 +32,7 @@ class CC_EXPORT DelegatingRenderer : public Renderer { virtual void Finish() OVERRIDE {} - virtual void SwapBuffers(const LatencyInfo& latency_info) OVERRIDE; + virtual void SwapBuffers(const ui::LatencyInfo& latency_info) OVERRIDE; virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index 7d37920..1afb384 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -1960,7 +1960,7 @@ void GLRenderer::Finish() { context_->finish(); } -void GLRenderer::SwapBuffers(const LatencyInfo& latency_info) { +void GLRenderer::SwapBuffers(const ui::LatencyInfo& latency_info) { DCHECK(visible_); DCHECK(!is_backbuffer_discarded_); diff --git a/cc/output/gl_renderer.h b/cc/output/gl_renderer.h index d90b32f..d4b7e1a 100644 --- a/cc/output/gl_renderer.h +++ b/cc/output/gl_renderer.h @@ -61,7 +61,7 @@ class CC_EXPORT GLRenderer virtual void DoNoOp() OVERRIDE; // Puts backbuffer onscreen. - virtual void SwapBuffers(const LatencyInfo& latency_info) OVERRIDE; + virtual void SwapBuffers(const ui::LatencyInfo& latency_info) OVERRIDE; virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc index 7e1a438..48a5951 100644 --- a/cc/output/gl_renderer_unittest.cc +++ b/cc/output/gl_renderer_unittest.cc @@ -268,7 +268,7 @@ class GLRendererTest : public testing::Test { virtual void SetUp() { renderer_.Initialize(); } - void SwapBuffers() { renderer_.SwapBuffers(LatencyInfo()); } + void SwapBuffers() { renderer_.SwapBuffers(ui::LatencyInfo()); } FrameCountingMemoryAllocationSettingContext* Context() { return static_cast<FrameCountingMemoryAllocationSettingContext*>( @@ -1482,8 +1482,8 @@ class MockOutputSurface : public OutputSurface { MOCK_METHOD0(DiscardBackbuffer, void()); MOCK_METHOD2(Reshape, void(gfx::Size size, float scale_factor)); MOCK_METHOD0(BindFramebuffer, void()); - MOCK_METHOD2(PostSubBuffer, void(gfx::Rect rect, const LatencyInfo&)); - MOCK_METHOD1(SwapBuffers, void(const LatencyInfo&)); + MOCK_METHOD2(PostSubBuffer, void(gfx::Rect rect, const ui::LatencyInfo&)); + MOCK_METHOD1(SwapBuffers, void(const ui::LatencyInfo&)); }; class MockOutputSurfaceTest : public testing::Test, public FakeRendererClient { @@ -1494,7 +1494,7 @@ class MockOutputSurfaceTest : public testing::Test, public FakeRendererClient { virtual void SetUp() { EXPECT_TRUE(renderer_.Initialize()); } - void SwapBuffers() { renderer_.SwapBuffers(LatencyInfo()); } + void SwapBuffers() { renderer_.SwapBuffers(ui::LatencyInfo()); } void DrawFrame() { gfx::Rect viewport_rect(DeviceViewportSize()); @@ -1536,31 +1536,31 @@ TEST_F(MockOutputSurfaceTest, DrawFrameAndSwap) { DrawFrame(); EXPECT_CALL(output_surface_, SwapBuffers(_)).Times(1); - renderer_.SwapBuffers(LatencyInfo()); + renderer_.SwapBuffers(ui::LatencyInfo()); } TEST_F(MockOutputSurfaceTest, DrawFrameAndResizeAndSwap) { DrawFrame(); EXPECT_CALL(output_surface_, SwapBuffers(_)).Times(1); - renderer_.SwapBuffers(LatencyInfo()); + renderer_.SwapBuffers(ui::LatencyInfo()); set_viewport_and_scale(gfx::Size(2, 2), 2.f); renderer_.ViewportChanged(); DrawFrame(); EXPECT_CALL(output_surface_, SwapBuffers(_)).Times(1); - renderer_.SwapBuffers(LatencyInfo()); + renderer_.SwapBuffers(ui::LatencyInfo()); DrawFrame(); EXPECT_CALL(output_surface_, SwapBuffers(_)).Times(1); - renderer_.SwapBuffers(LatencyInfo()); + renderer_.SwapBuffers(ui::LatencyInfo()); set_viewport_and_scale(gfx::Size(1, 1), 1.f); renderer_.ViewportChanged(); DrawFrame(); EXPECT_CALL(output_surface_, SwapBuffers(_)).Times(1); - renderer_.SwapBuffers(LatencyInfo()); + renderer_.SwapBuffers(ui::LatencyInfo()); } class MockOutputSurfaceTestWithPartialSwap : public MockOutputSurfaceTest { @@ -1576,7 +1576,7 @@ TEST_F(MockOutputSurfaceTestWithPartialSwap, DrawFrameAndSwap) { DrawFrame(); EXPECT_CALL(output_surface_, PostSubBuffer(_, _)).Times(1); - renderer_.SwapBuffers(LatencyInfo()); + renderer_.SwapBuffers(ui::LatencyInfo()); } class MockOutputSurfaceTestWithSendCompositorFrame diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc index ffc0b2a..6c46769 100644 --- a/cc/output/output_surface.cc +++ b/cc/output/output_surface.cc @@ -121,7 +121,7 @@ void OutputSurface::BindFramebuffer() { context3d_->bindFramebuffer(GL_FRAMEBUFFER, 0); } -void OutputSurface::SwapBuffers(const LatencyInfo& latency_info) { +void OutputSurface::SwapBuffers(const ui::LatencyInfo& latency_info) { DCHECK(context3d_); // Note that currently this has the same effect as SwapBuffers; we should // consider exposing a different entry point on WebGraphicsContext3D. @@ -129,7 +129,7 @@ void OutputSurface::SwapBuffers(const LatencyInfo& latency_info) { } void OutputSurface::PostSubBuffer(gfx::Rect rect, - const LatencyInfo& latency_info) { + const ui::LatencyInfo& latency_info) { DCHECK(context3d_); context3d_->postSubBufferCHROMIUM( rect.x(), rect.y(), rect.width(), rect.height()); diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h index fb6f0b9..a021ebf 100644 --- a/cc/output/output_surface.h +++ b/cc/output/output_surface.h @@ -11,6 +11,8 @@ #include "cc/output/software_output_device.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h" +namespace ui { struct LatencyInfo; } + namespace gfx { class Rect; class Size; @@ -21,7 +23,6 @@ namespace cc { class CompositorFrame; class OutputSurfaceClient; class OutputSurfaceCallbacks; -struct LatencyInfo; // Represents the output surface for a compositor. The compositor owns // and manages its destruction. Its lifetime is: @@ -91,8 +92,8 @@ class CC_EXPORT OutputSurface { virtual void BindFramebuffer(); - virtual void PostSubBuffer(gfx::Rect rect, const LatencyInfo&); - virtual void SwapBuffers(const LatencyInfo&); + virtual void PostSubBuffer(gfx::Rect rect, const ui::LatencyInfo&); + virtual void SwapBuffers(const ui::LatencyInfo&); // Notifies frame-rate smoothness preference. If true, all non-critical // processing should be stopped, or lowered in priority. diff --git a/cc/output/renderer.h b/cc/output/renderer.h index 5592090..aaf9fd7 100644 --- a/cc/output/renderer.h +++ b/cc/output/renderer.h @@ -7,10 +7,10 @@ #include "base/basictypes.h" #include "cc/base/cc_export.h" -#include "cc/debug/latency_info.h" #include "cc/quads/render_pass.h" #include "cc/resources/managed_memory_policy.h" #include "cc/trees/layer_tree_host.h" +#include "ui/base/latency_info.h" namespace cc { @@ -69,7 +69,7 @@ class CC_EXPORT Renderer { virtual void DoNoOp() {} // Puts backbuffer onscreen. - virtual void SwapBuffers(const LatencyInfo& latency_info) = 0; + virtual void SwapBuffers(const ui::LatencyInfo& latency_info) = 0; virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) = 0; diff --git a/cc/output/software_renderer.cc b/cc/output/software_renderer.cc index 4a337ff..b555b57 100644 --- a/cc/output/software_renderer.cc +++ b/cc/output/software_renderer.cc @@ -107,7 +107,7 @@ void SoftwareRenderer::FinishDrawingFrame(DrawingFrame* frame) { } } -void SoftwareRenderer::SwapBuffers(const LatencyInfo& latency_info) { +void SoftwareRenderer::SwapBuffers(const ui::LatencyInfo& latency_info) { if (Settings().compositor_frame_message) output_surface_->SendFrameToParentCompositor(&compositor_frame_); } diff --git a/cc/output/software_renderer.h b/cc/output/software_renderer.h index 72a5052..cbaf1d3 100644 --- a/cc/output/software_renderer.h +++ b/cc/output/software_renderer.h @@ -35,7 +35,7 @@ class CC_EXPORT SoftwareRenderer : public DirectRenderer { virtual const RendererCapabilities& Capabilities() const OVERRIDE; virtual void ViewportChanged() OVERRIDE; virtual void Finish() OVERRIDE; - virtual void SwapBuffers(const LatencyInfo& latency_info) OVERRIDE; + virtual void SwapBuffers(const ui::LatencyInfo& latency_info) OVERRIDE; virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; virtual void SetVisible(bool visible) OVERRIDE; virtual void SendManagedMemoryStats( diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index 6b7d772..966ff9d 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc @@ -596,7 +596,7 @@ void LayerTreeHost::SetVisible(bool visible) { proxy_->SetVisible(visible); } -void LayerTreeHost::SetLatencyInfo(const LatencyInfo& latency_info) { +void LayerTreeHost::SetLatencyInfo(const ui::LatencyInfo& latency_info) { latency_info_.MergeWith(latency_info); } diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index e5dd380..4226c23 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h @@ -18,7 +18,6 @@ #include "cc/animation/animation_events.h" #include "cc/base/cc_export.h" #include "cc/base/scoped_ptr_vector.h" -#include "cc/debug/latency_info.h" #include "cc/input/input_handler.h" #include "cc/input/scrollbar.h" #include "cc/input/top_controls_state.h" @@ -33,6 +32,7 @@ #include "skia/ext/refptr.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkPicture.h" +#include "ui/base/latency_info.h" #include "ui/gfx/rect.h" namespace WebKit { class WebGraphicsContext3D; } @@ -216,7 +216,7 @@ class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) { void ApplyScrollAndScale(const ScrollAndScaleSet& info); void SetImplTransform(const gfx::Transform& transform); - void SetLatencyInfo(const LatencyInfo& latency_info); + void SetLatencyInfo(const ui::LatencyInfo& latency_info); void StartRateLimiter(WebKit::WebGraphicsContext3D* context3d); void StopRateLimiter(WebKit::WebGraphicsContext3D* context3d); @@ -347,7 +347,7 @@ class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) { bool in_paint_layer_contents_; - LatencyInfo latency_info_; + ui::LatencyInfo latency_info_; static const int kTotalFramesToUseForLCDTextMetrics = 50; int total_frames_used_for_lcd_text_metrics_; diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index 15cc599..02c0a90 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h @@ -14,7 +14,6 @@ #include "cc/animation/animation_events.h" #include "cc/animation/animation_registrar.h" #include "cc/base/cc_export.h" -#include "cc/debug/latency_info.h" #include "cc/input/input_handler.h" #include "cc/input/layer_scroll_offset_delegate.h" #include "cc/input/top_controls_manager_client.h" @@ -27,6 +26,7 @@ #include "skia/ext/refptr.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkPicture.h" +#include "ui/base/latency_info.h" #include "ui/gfx/rect.h" namespace cc { @@ -146,7 +146,7 @@ class CC_EXPORT LayerTreeHostImpl LayerImplList will_draw_layers; bool contains_incomplete_tile; bool has_no_damage; - LatencyInfo latency_info; + ui::LatencyInfo latency_info; // RenderPassSink implementation. virtual void AppendRenderPass(scoped_ptr<RenderPass> render_pass) OVERRIDE; diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index e8d9dc2..e5705ca 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc @@ -554,11 +554,11 @@ void LayerTreeImpl::UpdateRootScrollLayerSizeDelta() { scrollable_viewport_size - original_viewport_size); } -void LayerTreeImpl::SetLatencyInfo(const LatencyInfo& latency_info) { +void LayerTreeImpl::SetLatencyInfo(const ui::LatencyInfo& latency_info) { latency_info_.MergeWith(latency_info); } -const LatencyInfo& LayerTreeImpl::GetLatencyInfo() { +const ui::LatencyInfo& LayerTreeImpl::GetLatencyInfo() { return latency_info_; } diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h index 3af49ca..304dbb9 100644 --- a/cc/trees/layer_tree_impl.h +++ b/cc/trees/layer_tree_impl.h @@ -10,8 +10,8 @@ #include "base/hash_tables.h" #include "base/values.h" -#include "cc/debug/latency_info.h" #include "cc/layers/layer_impl.h" +#include "ui/base/latency_info.h" #if defined(COMPILER_GCC) namespace BASE_HASH_NAMESPACE { @@ -186,8 +186,8 @@ class CC_EXPORT LayerTreeImpl { void SetRootLayerScrollOffsetDelegate( LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate); - void SetLatencyInfo(const LatencyInfo& latency_info); - const LatencyInfo& GetLatencyInfo(); + void SetLatencyInfo(const ui::LatencyInfo& latency_info); + const ui::LatencyInfo& GetLatencyInfo(); void ClearLatencyInfo(); void WillModifyTilePriorities(); @@ -233,7 +233,7 @@ class CC_EXPORT LayerTreeImpl { // structural differences relative to the active tree. bool needs_full_tree_sync_; - LatencyInfo latency_info_; + ui::LatencyInfo latency_info_; DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); }; diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc index 5edb7c1..9598311 100644 --- a/content/browser/gpu/gpu_process_host_ui_shim.cc +++ b/content/browser/gpu/gpu_process_host_ui_shim.cc @@ -343,7 +343,7 @@ void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( view->AcceleratedSurfaceBuffersSwapped(params, host_id_); } -void GpuProcessHostUIShim::OnFrameDrawn(const cc::LatencyInfo& latency_info) { +void GpuProcessHostUIShim::OnFrameDrawn(const ui::LatencyInfo& latency_info) { } void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( diff --git a/content/browser/gpu/gpu_process_host_ui_shim.h b/content/browser/gpu/gpu_process_host_ui_shim.h index cb155426..9f4329a 100644 --- a/content/browser/gpu/gpu_process_host_ui_shim.h +++ b/content/browser/gpu/gpu_process_host_ui_shim.h @@ -28,7 +28,7 @@ struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; struct GpuHostMsg_AcceleratedSurfaceRelease_Params; -namespace cc { +namespace ui { struct LatencyInfo; } @@ -107,7 +107,7 @@ class GpuProcessHostUIShim : public IPC::Listener, void OnUpdateVSyncParameters(int surface_id, base::TimeTicks timebase, base::TimeDelta interval); - void OnFrameDrawn(const cc::LatencyInfo& latency_info); + void OnFrameDrawn(const ui::LatencyInfo& latency_info); // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. int host_id_; diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index a9b9a66..02bd1f6 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc @@ -49,8 +49,8 @@ class DirectOutputSurface : public cc::OutputSurface { : cc::OutputSurface(context3d.Pass()) {} virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE {} - virtual void PostSubBuffer(gfx::Rect rect, const cc::LatencyInfo&) OVERRIDE {} - virtual void SwapBuffers(const cc::LatencyInfo&) OVERRIDE { + virtual void PostSubBuffer(gfx::Rect rect, const ui::LatencyInfo&) OVERRIDE {} + virtual void SwapBuffers(const ui::LatencyInfo&) OVERRIDE { context3d()->shallowFlushCHROMIUM(); } }; diff --git a/content/browser/renderer_host/event_with_latency_info.h b/content/browser/renderer_host/event_with_latency_info.h index f7891ff..e481afa 100644 --- a/content/browser/renderer_host/event_with_latency_info.h +++ b/content/browser/renderer_host/event_with_latency_info.h @@ -5,7 +5,7 @@ #ifndef CONTENT_BROWSER_RENDERER_HOST_EVENT_WITH_LATENCY_INFO_H_ #define CONTENT_BROWSER_RENDERER_HOST_EVENT_WITH_LATENCY_INFO_H_ -#include <cc/debug/latency_info.h> +#include "ui/base/latency_info.h" namespace WebKit { class WebGestureEvent; @@ -19,9 +19,9 @@ template <typename T> class EventWithLatencyInfo { public: T event; - cc::LatencyInfo latency; + ui::LatencyInfo latency; - EventWithLatencyInfo(const T& e, const cc::LatencyInfo& l) + EventWithLatencyInfo(const T& e, const ui::LatencyInfo& l) : event(e), latency(l) {} EventWithLatencyInfo() {} diff --git a/content/browser/renderer_host/overscroll_controller.cc b/content/browser/renderer_host/overscroll_controller.cc index b6cafe1..66c23cc 100644 --- a/content/browser/renderer_host/overscroll_controller.cc +++ b/content/browser/renderer_host/overscroll_controller.cc @@ -27,7 +27,7 @@ OverscrollController::~OverscrollController() { bool OverscrollController::WillDispatchEvent( const WebKit::WebInputEvent& event, - const cc::LatencyInfo& latency_info) { + const ui::LatencyInfo& latency_info) { if (scroll_state_ != STATE_UNKNOWN) { if (event.type == WebKit::WebInputEvent::GestureScrollEnd) { scroll_state_ = STATE_UNKNOWN; diff --git a/content/browser/renderer_host/overscroll_controller.h b/content/browser/renderer_host/overscroll_controller.h index 71d6e9a..39d15dc 100644 --- a/content/browser/renderer_host/overscroll_controller.h +++ b/content/browser/renderer_host/overscroll_controller.h @@ -9,7 +9,7 @@ #include "base/compiler_specific.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" -namespace cc { +namespace ui { struct LatencyInfo; } @@ -44,7 +44,7 @@ class OverscrollController { // updated properly. // Returns true if the event should be dispatched, false otherwise. bool WillDispatchEvent(const WebKit::WebInputEvent& event, - const cc::LatencyInfo& latency_info); + const ui::LatencyInfo& latency_info); // This must be called when the ACK for any event comes in. This updates the // overscroll gesture status as appropriate. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index a86b690..d0637ac 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -985,7 +985,7 @@ void RenderWidgetHostImpl::ForwardWheelEvent( void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( const WebMouseWheelEvent& wheel_event, - const cc::LatencyInfo& latency_info) { + const ui::LatencyInfo& latency_info) { TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo"); if (ignore_input_events_ || process_->IgnoreInputEvents()) @@ -1048,7 +1048,7 @@ void RenderWidgetHostImpl::ForwardGestureEvent( if (ignore_input_events_ || process_->IgnoreInputEvents()) return; - cc::LatencyInfo latency_info = NewInputLatencyInfo(); + ui::LatencyInfo latency_info = NewInputLatencyInfo(); if (!IsInOverscrollGesture() && !gesture_event_filter_->ShouldForward( @@ -1203,16 +1203,17 @@ int64 RenderWidgetHostImpl::GetLatencyComponentId() { return GetRoutingID() | (static_cast<int64>(GetProcess()->GetID()) << 32); } -cc::LatencyInfo RenderWidgetHostImpl::NewInputLatencyInfo() { - cc::LatencyInfo info; - info.AddLatencyNumber( - cc::kInputEvent, GetLatencyComponentId(), ++last_input_number_); +ui::LatencyInfo RenderWidgetHostImpl::NewInputLatencyInfo() { + ui::LatencyInfo info; + info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_COMPONENT, + GetLatencyComponentId(), + ++last_input_number_); return info; } void RenderWidgetHostImpl::SendInputEvent(const WebInputEvent& input_event, int event_size, - const cc::LatencyInfo& latency_info, + const ui::LatencyInfo& latency_info, bool is_keyboard_shortcut) { input_event_start_time_ = TimeTicks::Now(); Send(new InputMsg_HandleInputEvent( @@ -1222,7 +1223,7 @@ void RenderWidgetHostImpl::SendInputEvent(const WebInputEvent& input_event, void RenderWidgetHostImpl::ForwardInputEvent( const WebInputEvent& input_event, int event_size, - const cc::LatencyInfo& latency_info, bool is_keyboard_shortcut) { + const ui::LatencyInfo& latency_info, bool is_keyboard_shortcut) { TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::ForwardInputEvent"); if (!process_->HasConnection()) @@ -2485,7 +2486,7 @@ void RenderWidgetHostImpl::DetachDelegate() { delegate_ = NULL; } -void RenderWidgetHostImpl::FrameSwapped(const cc::LatencyInfo& latency_info) { +void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) { } } // namespace content diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index fcf246c..534933b 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -23,7 +23,6 @@ #include "base/time.h" #include "base/timer.h" #include "build/build_config.h" -#include "cc/debug/latency_info.h" #include "content/browser/renderer_host/event_with_latency_info.h" #include "content/browser/renderer_host/smooth_scroll_gesture_controller.h" #include "content/common/view_message_enums.h" @@ -32,6 +31,7 @@ #include "content/public/common/page_zoom.h" #include "ipc/ipc_listener.h" #include "ui/base/ime/text_input_type.h" +#include "ui/base/latency_info.h" #include "ui/gfx/native_widget_types.h" class WebCursor; @@ -479,7 +479,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost, // other way around. bool should_auto_resize() { return should_auto_resize_; } - void FrameSwapped(const cc::LatencyInfo& latency_info); + void FrameSwapped(const ui::LatencyInfo& latency_info); // Returns the ID that uniquely describes this component to the latency // subsystem. @@ -491,12 +491,12 @@ class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost, // Transmits the given input event. This is an internal helper for // |ForwardInputEvent()| and should not be used directly from elsewhere. void SendInputEvent(const WebKit::WebInputEvent& input_event, - int event_size, const cc::LatencyInfo& latency_info, + int event_size, const ui::LatencyInfo& latency_info, bool is_keyboard_shortcut); // Internal implementation of the public Forward*Event() methods. void ForwardInputEvent(const WebKit::WebInputEvent& input_event, - int event_size, const cc::LatencyInfo& latency_info, + int event_size, const ui::LatencyInfo& latency_info, bool is_keyboard_shortcut); // Internal forwarding implementations that take a LatencyInfo. @@ -504,10 +504,10 @@ class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost, const MouseEventWithLatencyInfo& mouse_event); virtual void ForwardWheelEventWithLatencyInfo( const WebKit::WebMouseWheelEvent& wheel_event, - const cc::LatencyInfo& latency_info); + const ui::LatencyInfo& latency_info); // Create a LatencyInfo struct for a new input event that was just received. - cc::LatencyInfo NewInputLatencyInfo(); + ui::LatencyInfo NewInputLatencyInfo(); // Called when we receive a notification indicating that the renderer // process has gone. This will reset our state so that our state will be diff --git a/content/browser/renderer_host/touchpad_tap_suppression_controller.h b/content/browser/renderer_host/touchpad_tap_suppression_controller.h index 76e1fc1..e2ce4c9 100644 --- a/content/browser/renderer_host/touchpad_tap_suppression_controller.h +++ b/content/browser/renderer_host/touchpad_tap_suppression_controller.h @@ -6,7 +6,6 @@ #define CONTENT_BROWSER_RENDERER_HOST_TOUCHPAD_TAP_SUPPRESSION_CONTROLLER_H_ #include "base/memory/scoped_ptr.h" -#include "cc/debug/latency_info.h" #include "content/browser/renderer_host/event_with_latency_info.h" #include "content/browser/renderer_host/tap_suppression_controller_client.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" diff --git a/content/common/cc_messages.h b/content/common/cc_messages.h index 79d6bfc..bceaafe 100644 --- a/content/common/cc_messages.h +++ b/content/common/cc_messages.h @@ -4,7 +4,6 @@ // // IPC Messages sent between compositor instances. -#include "cc/debug/latency_info.h" #include "cc/output/compositor_frame.h" #include "cc/output/compositor_frame_ack.h" #include "cc/quads/checkerboard_draw_quad.h" @@ -107,7 +106,6 @@ struct CONTENT_EXPORT ParamTraits<cc::DelegatedFrameData> { IPC_ENUM_TRAITS(cc::DrawQuad::Material) IPC_ENUM_TRAITS(cc::IOSurfaceDrawQuad::Orientation) -IPC_ENUM_TRAITS(cc::LatencyComponentType) IPC_ENUM_TRAITS(WebKit::WebFilterOperation::FilterType) IPC_STRUCT_TRAITS_BEGIN(cc::RenderPass::Id) @@ -213,17 +211,6 @@ IPC_STRUCT_TRAITS_BEGIN(cc::TransferableResource) IPC_STRUCT_TRAITS_MEMBER(mailbox) IPC_STRUCT_TRAITS_END() -IPC_STRUCT_TRAITS_BEGIN(cc::LatencyInfo::LatencyComponent) - IPC_STRUCT_TRAITS_MEMBER(sequence_number) - IPC_STRUCT_TRAITS_MEMBER(event_time) - IPC_STRUCT_TRAITS_MEMBER(event_count) -IPC_STRUCT_TRAITS_END() - -IPC_STRUCT_TRAITS_BEGIN(cc::LatencyInfo) - IPC_STRUCT_TRAITS_MEMBER(latency_components) - IPC_STRUCT_TRAITS_MEMBER(swap_timestamp) -IPC_STRUCT_TRAITS_END() - IPC_STRUCT_TRAITS_BEGIN(cc::CompositorFrameMetadata) IPC_STRUCT_TRAITS_MEMBER(device_scale_factor) IPC_STRUCT_TRAITS_MEMBER(root_scroll_offset) diff --git a/content/common/content_param_traits_macros.h b/content/common/content_param_traits_macros.h index 332f8f0..79aa6a7 100644 --- a/content/common/content_param_traits_macros.h +++ b/content/common/content_param_traits_macros.h @@ -11,6 +11,7 @@ #include "content/common/content_export.h" #include "ipc/ipc_message_macros.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" +#include "ui/base/latency_info.h" #include "webkit/glue/resource_type.h" #undef IPC_MESSAGE_EXPORT @@ -18,5 +19,17 @@ IPC_ENUM_TRAITS(ResourceType::Type) IPC_ENUM_TRAITS(WebKit::WebInputEvent::Type) +IPC_ENUM_TRAITS(ui::LatencyComponentType) + +IPC_STRUCT_TRAITS_BEGIN(ui::LatencyInfo::LatencyComponent) + IPC_STRUCT_TRAITS_MEMBER(sequence_number) + IPC_STRUCT_TRAITS_MEMBER(event_time) + IPC_STRUCT_TRAITS_MEMBER(event_count) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(ui::LatencyInfo) + IPC_STRUCT_TRAITS_MEMBER(latency_components) + IPC_STRUCT_TRAITS_MEMBER(swap_timestamp) +IPC_STRUCT_TRAITS_END() #endif // CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_ diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc index 4d918c6..47b4ce0 100644 --- a/content/common/gpu/client/command_buffer_proxy_impl.cc +++ b/content/common/gpu/client/command_buffer_proxy_impl.cc @@ -211,7 +211,7 @@ void CommandBufferProxyImpl::Flush(int32 put_offset) { } void CommandBufferProxyImpl::SetLatencyInfo( - const cc::LatencyInfo& latency_info) { + const ui::LatencyInfo& latency_info) { if (last_state_.error != gpu::error::kNoError) return; Send(new GpuCommandBufferMsg_SetLatencyInfo(route_id_, latency_info)); diff --git a/content/common/gpu/client/command_buffer_proxy_impl.h b/content/common/gpu/client/command_buffer_proxy_impl.h index 1f37af5..4b52bb4 100644 --- a/content/common/gpu/client/command_buffer_proxy_impl.h +++ b/content/common/gpu/client/command_buffer_proxy_impl.h @@ -17,13 +17,13 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" -#include "cc/debug/latency_info.h" #include "content/common/gpu/gpu_memory_allocation.h" #include "content/common/gpu/gpu_memory_allocation.h" #include "gpu/command_buffer/common/command_buffer.h" #include "gpu/command_buffer/common/command_buffer_shared.h" #include "ipc/ipc_listener.h" #include "media/video/video_decode_accelerator.h" +#include "ui/base/latency_info.h" struct GPUCommandBufferConsoleMessage; @@ -127,7 +127,7 @@ class CommandBufferProxyImpl void SetOnConsoleMessageCallback( const GpuConsoleMessageCallback& callback); - void SetLatencyInfo(const cc::LatencyInfo& latency_info); + void SetLatencyInfo(const ui::LatencyInfo& latency_info); // TODO(apatrick): this is a temporary optimization while skia is calling // ContentGLContext::MakeCurrent prior to every GL call. It saves returning 6 diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index 1e89262..893d8ee 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -572,7 +572,7 @@ void GpuCommandBufferStub::OnInitialize( } void GpuCommandBufferStub::OnSetLatencyInfo( - const cc::LatencyInfo& latency_info) { + const ui::LatencyInfo& latency_info) { if (!latency_info_callback_.is_null()) latency_info_callback_.Run(latency_info); } diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h index c7f8195..7700a6b 100644 --- a/content/common/gpu/gpu_command_buffer_stub.h +++ b/content/common/gpu/gpu_command_buffer_stub.h @@ -12,7 +12,6 @@ #include "base/memory/scoped_vector.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" -#include "cc/debug/latency_info.h" #include "content/common/content_export.h" #include "content/common/gpu/gpu_memory_allocation.h" #include "content/common/gpu/gpu_memory_manager.h" @@ -25,6 +24,7 @@ #include "ipc/ipc_listener.h" #include "ipc/ipc_sender.h" #include "media/base/video_decoder_config.h" +#include "ui/base/latency_info.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/size.h" #include "ui/gl/gl_surface.h" @@ -59,7 +59,7 @@ class GpuCommandBufferStub virtual ~DestructionObserver() {} }; - typedef base::Callback<void(const cc::LatencyInfo&)> + typedef base::Callback<void(const ui::LatencyInfo&)> LatencyInfoCallback; GpuCommandBufferStub( @@ -183,7 +183,7 @@ class GpuCommandBufferStub void OnCommandProcessed(); void OnParseError(); - void OnSetLatencyInfo(const cc::LatencyInfo& latency_info); + void OnSetLatencyInfo(const ui::LatencyInfo& latency_info); void ReportState(); diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index acc3f67..c4a5de6 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h @@ -9,7 +9,6 @@ #include <vector> #include "base/shared_memory.h" -#include "cc/debug/latency_info.h" #include "content/common/content_export.h" #include "content/common/gpu/gpu_memory_allocation.h" #include "content/common/gpu/gpu_memory_uma_stats.h" @@ -24,6 +23,7 @@ #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_message_macros.h" #include "media/video/video_decode_accelerator.h" +#include "ui/base/latency_info.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/size.h" #include "ui/gl/gpu_preference.h" @@ -52,7 +52,7 @@ IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params) IPC_STRUCT_MEMBER(std::string, mailbox_name) IPC_STRUCT_MEMBER(gfx::Size, size) IPC_STRUCT_MEMBER(float, scale_factor) - IPC_STRUCT_MEMBER(cc::LatencyInfo, latency_info) + IPC_STRUCT_MEMBER(ui::LatencyInfo, latency_info) IPC_STRUCT_END() #undef IPC_MESSAGE_EXPORT #define IPC_MESSAGE_EXPORT @@ -68,7 +68,7 @@ IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params) IPC_STRUCT_MEMBER(std::string, mailbox_name) IPC_STRUCT_MEMBER(gfx::Size, surface_size) IPC_STRUCT_MEMBER(float, surface_scale_factor) - IPC_STRUCT_MEMBER(cc::LatencyInfo, latency_info) + IPC_STRUCT_MEMBER(ui::LatencyInfo, latency_info) IPC_STRUCT_END() IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceRelease_Params) @@ -371,7 +371,7 @@ IPC_MESSAGE_CONTROL3(GpuHostMsg_ResizeView, // Tells the browser that a frame with the specific latency info was drawn to // the screen IPC_MESSAGE_CONTROL1(GpuHostMsg_FrameDrawn, - cc::LatencyInfo /* latency_info */) + ui::LatencyInfo /* latency_info */) // Same as above with a rect of the part of the surface that changed. IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, @@ -517,7 +517,7 @@ IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_AsyncFlush, // Sends information about the latency of the current frame to the GPU // process. IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetLatencyInfo, - cc::LatencyInfo /* latency_info */) + ui::LatencyInfo /* latency_info */) // Asynchronously process any commands known to the GPU process. This is only // used in the event that a channel is unscheduled and needs to be flushed diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc index 6775a29..a2789af 100644 --- a/content/common/gpu/image_transport_surface.cc +++ b/content/common/gpu/image_transport_surface.cc @@ -54,7 +54,7 @@ ImageTransportHelper::ImageTransportHelper(ImageTransportSurface* surface, ImageTransportHelper::~ImageTransportHelper() { if (stub_) { stub_->SetLatencyInfoCallback( - base::Callback<void(const cc::LatencyInfo&)>()); + base::Callback<void(const ui::LatencyInfo&)>()); } manager_->RemoveRoute(route_id_); } @@ -128,7 +128,7 @@ void ImageTransportHelper::SendUpdateVSyncParameters( } void ImageTransportHelper::SendLatencyInfo( - const cc::LatencyInfo& latency_info) { + const ui::LatencyInfo& latency_info) { manager_->Send(new GpuHostMsg_FrameDrawn(latency_info)); } @@ -201,7 +201,7 @@ void ImageTransportHelper::Resize(gfx::Size size, float scale_factor) { } void ImageTransportHelper::SetLatencyInfo( - const cc::LatencyInfo& latency_info) { + const ui::LatencyInfo& latency_info) { surface_->SetLatencyInfo(latency_info); } @@ -242,7 +242,7 @@ bool PassThroughImageTransportSurface::DeferDraws() { } void PassThroughImageTransportSurface::SetLatencyInfo( - const cc::LatencyInfo& latency_info) { + const ui::LatencyInfo& latency_info) { latency_info_ = latency_info; } diff --git a/content/common/gpu/image_transport_surface.h b/content/common/gpu/image_transport_surface.h index 0a9b30b..4de68a4 100644 --- a/content/common/gpu/image_transport_surface.h +++ b/content/common/gpu/image_transport_surface.h @@ -12,10 +12,10 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "cc/debug/latency_info.h" #include "content/common/content_export.h" #include "ipc/ipc_listener.h" #include "ipc/ipc_message.h" +#include "ui/base/latency_info.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/rect.h" #include "ui/gfx/size.h" @@ -65,7 +65,7 @@ class ImageTransportSurface { virtual void OnResizeViewACK() = 0; virtual void OnResize(gfx::Size size, float scale_factor) = 0; virtual void SetLatencyInfo( - const cc::LatencyInfo& latency_info) = 0; + const ui::LatencyInfo& latency_info) = 0; // Creates a surface with the given attributes. static scoped_refptr<gfx::GLSurface> CreateSurface( @@ -127,7 +127,7 @@ class ImageTransportHelper void SendUpdateVSyncParameters( base::TimeTicks timebase, base::TimeDelta interval); - void SendLatencyInfo(const cc::LatencyInfo& latency_info); + void SendLatencyInfo(const ui::LatencyInfo& latency_info); // Whether or not we should execute more commands. void SetScheduled(bool is_scheduled); @@ -160,7 +160,7 @@ class ImageTransportHelper // Backbuffer resize callback. void Resize(gfx::Size size, float scale_factor); - void SetLatencyInfo(const cc::LatencyInfo& latency_info); + void SetLatencyInfo(const ui::LatencyInfo& latency_info); // Weak pointers that point to objects that outlive this helper. ImageTransportSurface* surface_; @@ -199,7 +199,7 @@ class PassThroughImageTransportSurface virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; virtual gfx::Size GetSize() OVERRIDE; virtual void SetLatencyInfo( - const cc::LatencyInfo& latency_info) OVERRIDE; + const ui::LatencyInfo& latency_info) OVERRIDE; protected: virtual ~PassThroughImageTransportSurface(); @@ -215,7 +215,7 @@ class PassThroughImageTransportSurface bool did_set_swap_interval_; bool did_unschedule_; bool is_swap_buffers_pending_; - cc::LatencyInfo latency_info_; + ui::LatencyInfo latency_info_; DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); }; diff --git a/content/common/gpu/image_transport_surface_mac.cc b/content/common/gpu/image_transport_surface_mac.cc index 23ed250..c651104 100644 --- a/content/common/gpu/image_transport_surface_mac.cc +++ b/content/common/gpu/image_transport_surface_mac.cc @@ -60,7 +60,7 @@ class IOSurfaceImageTransportSurface : public gfx::NoOpGLSurfaceCGL, const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; virtual void OnResizeViewACK() OVERRIDE; virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; - virtual void SetLatencyInfo(const cc::LatencyInfo&) OVERRIDE; + virtual void SetLatencyInfo(const ui::LatencyInfo&) OVERRIDE; private: virtual ~IOSurfaceImageTransportSurface() OVERRIDE; @@ -97,7 +97,7 @@ class IOSurfaceImageTransportSurface : public gfx::NoOpGLSurfaceCGL, // Whether we unscheduled command buffer because of pending SwapBuffers. bool did_unschedule_; - cc::LatencyInfo latency_info_; + ui::LatencyInfo latency_info_; scoped_ptr<ImageTransportHelper> helper_; @@ -309,7 +309,7 @@ void IOSurfaceImageTransportSurface::OnResize(gfx::Size size, } void IOSurfaceImageTransportSurface::SetLatencyInfo( - const cc::LatencyInfo& latency_info) { + const ui::LatencyInfo& latency_info) { latency_info_ = latency_info; } diff --git a/content/common/gpu/image_transport_surface_win.cc b/content/common/gpu/image_transport_surface_win.cc index c37e7d8..a7ebaa8 100644 --- a/content/common/gpu/image_transport_surface_win.cc +++ b/content/common/gpu/image_transport_surface_win.cc @@ -48,7 +48,7 @@ class PbufferImageTransportSurface const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; virtual void OnResizeViewACK() OVERRIDE; virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; - virtual void SetLatencyInfo(const cc::LatencyInfo&) OVERRIDE; + virtual void SetLatencyInfo(const ui::LatencyInfo&) OVERRIDE; virtual gfx::Size GetSize() OVERRIDE; private: @@ -69,7 +69,7 @@ class PbufferImageTransportSurface // Size to resize to when the surface becomes visible. gfx::Size visible_size_; - cc::LatencyInfo latency_info_; + ui::LatencyInfo latency_info_; scoped_ptr<ImageTransportHelper> helper_; @@ -231,7 +231,7 @@ void PbufferImageTransportSurface::OnResize(gfx::Size size, } void PbufferImageTransportSurface::SetLatencyInfo( - const cc::LatencyInfo& latency_info) { + const ui::LatencyInfo& latency_info) { latency_info_ = latency_info; } diff --git a/content/common/gpu/texture_image_transport_surface.cc b/content/common/gpu/texture_image_transport_surface.cc index be29974..3448927 100644 --- a/content/common/gpu/texture_image_transport_surface.cc +++ b/content/common/gpu/texture_image_transport_surface.cc @@ -196,7 +196,7 @@ void TextureImageTransportSurface::OnWillDestroyStub() { } void TextureImageTransportSurface::SetLatencyInfo( - const cc::LatencyInfo& latency_info) { + const ui::LatencyInfo& latency_info) { latency_info_ = latency_info; } diff --git a/content/common/gpu/texture_image_transport_surface.h b/content/common/gpu/texture_image_transport_surface.h index 9510625..22af052 100644 --- a/content/common/gpu/texture_image_transport_surface.h +++ b/content/common/gpu/texture_image_transport_surface.h @@ -56,7 +56,7 @@ class TextureImageTransportSurface virtual void OnResizeViewACK() OVERRIDE; virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; virtual void SetLatencyInfo( - const cc::LatencyInfo& latency_info) OVERRIDE; + const ui::LatencyInfo& latency_info) OVERRIDE; // GpuCommandBufferStub::DestructionObserver implementation. virtual void OnWillDestroyStub() OVERRIDE; @@ -120,7 +120,7 @@ class TextureImageTransportSurface // Holds a reference to the mailbox manager for cleanup. scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; - cc::LatencyInfo latency_info_; + ui::LatencyInfo latency_info_; DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface); }; diff --git a/content/common/input_messages.h b/content/common/input_messages.h index a9739fa..fd4ca81 100644 --- a/content/common/input_messages.h +++ b/content/common/input_messages.h @@ -7,7 +7,6 @@ // Multiply-included message file, hence no include guard. #include "base/string16.h" -#include "cc/debug/latency_info.h" #include "content/common/content_export.h" #include "content/common/content_param_traits.h" #include "content/common/edit_command.h" @@ -15,6 +14,7 @@ #include "content/public/common/common_param_traits.h" #include "ipc/ipc_message_macros.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" +#include "ui/base/latency_info.h" #include "ui/gfx/point.h" #include "ui/gfx/rect.h" @@ -37,7 +37,7 @@ IPC_STRUCT_TRAITS_END() // Sends an input event to the render widget. IPC_MESSAGE_ROUTED3(InputMsg_HandleInputEvent, IPC::WebInputEventPointer /* event */, - cc::LatencyInfo /* latency_info */, + ui::LatencyInfo /* latency_info */, bool /* is_keyboard_shortcut */) // Sends the cursor visibility state to the render widget. diff --git a/content/public/test/render_view_test.cc b/content/public/test/render_view_test.cc index 6c3dd33..c1dfe26 100644 --- a/content/public/test/render_view_test.cc +++ b/content/public/test/render_view_test.cc @@ -217,14 +217,14 @@ void RenderViewTest::SendWebKeyboardEvent( const WebKit::WebKeyboardEvent& key_event) { RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); impl->OnMessageReceived( - InputMsg_HandleInputEvent(0, &key_event, cc::LatencyInfo(), false)); + InputMsg_HandleInputEvent(0, &key_event, ui::LatencyInfo(), false)); } void RenderViewTest::SendWebMouseEvent( const WebKit::WebMouseEvent& mouse_event) { RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); impl->OnMessageReceived( - InputMsg_HandleInputEvent(0, &mouse_event, cc::LatencyInfo(), false)); + InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false)); } const char* const kGetCoordinatesScript = @@ -283,7 +283,7 @@ bool RenderViewTest::SimulateElementClick(const std::string& element_id) { mouse_event.y = bounds.CenterPoint().y(); mouse_event.clickCount = 1; scoped_ptr<IPC::Message> input_message( - new InputMsg_HandleInputEvent(0, &mouse_event, cc::LatencyInfo(), false)); + new InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false)); RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); impl->OnMessageReceived(*input_message); return true; diff --git a/content/renderer/android/synchronous_compositor_output_surface.cc b/content/renderer/android/synchronous_compositor_output_surface.cc index ad22021..8b06c1f 100644 --- a/content/renderer/android/synchronous_compositor_output_surface.cc +++ b/content/renderer/android/synchronous_compositor_output_surface.cc @@ -138,7 +138,7 @@ void SynchronousCompositorOutputSurface::SetNeedsBeginFrame( } void SynchronousCompositorOutputSurface::SwapBuffers( - const cc::LatencyInfo& info) { + const ui::LatencyInfo& info) { context3d()->shallowFlushCHROMIUM(); did_swap_buffer_ = true; } diff --git a/content/renderer/android/synchronous_compositor_output_surface.h b/content/renderer/android/synchronous_compositor_output_surface.h index 6748e9c..611d424 100644 --- a/content/renderer/android/synchronous_compositor_output_surface.h +++ b/content/renderer/android/synchronous_compositor_output_surface.h @@ -37,7 +37,7 @@ class SynchronousCompositorOutputSurface virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE; virtual void SendFrameToParentCompositor(cc::CompositorFrame* frame) OVERRIDE; virtual void SetNeedsBeginFrame(bool enable) OVERRIDE; - virtual void SwapBuffers(const cc::LatencyInfo& info) OVERRIDE; + virtual void SwapBuffers(const ui::LatencyInfo& info) OVERRIDE; // SynchronousCompositor. virtual void SetClient(SynchronousCompositorClient* compositor_client) diff --git a/content/renderer/gpu/compositor_output_surface.cc b/content/renderer/gpu/compositor_output_surface.cc index 7f4d809..0dd70f6 100644 --- a/content/renderer/gpu/compositor_output_surface.cc +++ b/content/renderer/gpu/compositor_output_surface.cc @@ -100,7 +100,7 @@ void CompositorOutputSurface::SendFrameToParentCompositor( } void CompositorOutputSurface::SwapBuffers( - const cc::LatencyInfo& latency_info) { + const ui::LatencyInfo& latency_info) { WebGraphicsContext3DCommandBufferImpl* command_buffer = static_cast<WebGraphicsContext3DCommandBufferImpl*>(context3d()); CommandBufferProxyImpl* command_buffer_proxy = @@ -112,7 +112,7 @@ void CompositorOutputSurface::SwapBuffers( } void CompositorOutputSurface::PostSubBuffer( - gfx::Rect rect, const cc::LatencyInfo& latency_info) { + gfx::Rect rect, const ui::LatencyInfo& latency_info) { WebGraphicsContext3DCommandBufferImpl* command_buffer = static_cast<WebGraphicsContext3DCommandBufferImpl*>(context3d()); CommandBufferProxyImpl* command_buffer_proxy = diff --git a/content/renderer/gpu/compositor_output_surface.h b/content/renderer/gpu/compositor_output_surface.h index 344381f..7f13852 100644 --- a/content/renderer/gpu/compositor_output_surface.h +++ b/content/renderer/gpu/compositor_output_surface.h @@ -50,8 +50,8 @@ class CompositorOutputSurface // cc::OutputSurface implementation. virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE; virtual void SendFrameToParentCompositor(cc::CompositorFrame*) OVERRIDE; - virtual void PostSubBuffer(gfx::Rect rect, const cc::LatencyInfo&) OVERRIDE; - virtual void SwapBuffers(const cc::LatencyInfo&) OVERRIDE; + virtual void PostSubBuffer(gfx::Rect rect, const ui::LatencyInfo&) OVERRIDE; + virtual void SwapBuffers(const ui::LatencyInfo&) OVERRIDE; #if defined(OS_ANDROID) virtual void SetNeedsBeginFrame(bool enable) OVERRIDE; #endif diff --git a/content/renderer/gpu/input_event_filter_unittest.cc b/content/renderer/gpu/input_event_filter_unittest.cc index 12c0417..85da87f 100644 --- a/content/renderer/gpu/input_event_filter_unittest.cc +++ b/content/renderer/gpu/input_event_filter_unittest.cc @@ -120,7 +120,7 @@ void AddEventsToFilter(IPC::ChannelProxy::MessageFilter* message_filter, for (size_t i = 0; i < count; ++i) { messages.push_back( InputMsg_HandleInputEvent( - kTestRoutingID, &events[i], cc::LatencyInfo(), false)); + kTestRoutingID, &events[i], ui::LatencyInfo(), false)); } AddMessagesToFilter(message_filter, messages); @@ -255,7 +255,7 @@ TEST_F(InputEventFilterTest, PreserveRelativeOrder) { std::vector<IPC::Message> messages; messages.push_back(InputMsg_HandleInputEvent(kTestRoutingID, &mouse_down, - cc::LatencyInfo(), + ui::LatencyInfo(), false)); // Control where input events are delivered. messages.push_back(InputMsg_MouseCaptureLost(kTestRoutingID)); @@ -284,7 +284,7 @@ TEST_F(InputEventFilterTest, PreserveRelativeOrder) { messages.push_back(InputMsg_HandleInputEvent(kTestRoutingID, &mouse_up, - cc::LatencyInfo(), + ui::LatencyInfo(), false)); AddMessagesToFilter(filter_, messages); diff --git a/content/renderer/gpu/mailbox_output_surface.cc b/content/renderer/gpu/mailbox_output_surface.cc index 2324fe8..cb7847d 100644 --- a/content/renderer/gpu/mailbox_output_surface.cc +++ b/content/renderer/gpu/mailbox_output_surface.cc @@ -197,11 +197,11 @@ void MailboxOutputSurface::OnSwapAck(const cc::CompositorFrameAck& ack) { CompositorOutputSurface::OnSwapAck(ack); } -void MailboxOutputSurface::SwapBuffers(const cc::LatencyInfo&) { +void MailboxOutputSurface::SwapBuffers(const ui::LatencyInfo&) { } void MailboxOutputSurface::PostSubBuffer(gfx::Rect rect, - const cc::LatencyInfo&) { + const ui::LatencyInfo&) { NOTIMPLEMENTED() << "Partial swap not supported with composite-to-mailbox yet."; diff --git a/content/renderer/gpu/mailbox_output_surface.h b/content/renderer/gpu/mailbox_output_surface.h index 77fc7d4..9f2119f 100644 --- a/content/renderer/gpu/mailbox_output_surface.h +++ b/content/renderer/gpu/mailbox_output_surface.h @@ -34,8 +34,8 @@ class MailboxOutputSurface : public CompositorOutputSurface { virtual void DiscardBackbuffer() OVERRIDE; virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE; virtual void BindFramebuffer() OVERRIDE; - virtual void PostSubBuffer(gfx::Rect rect, const cc::LatencyInfo&) OVERRIDE; - virtual void SwapBuffers(const cc::LatencyInfo&) OVERRIDE; + virtual void PostSubBuffer(gfx::Rect rect, const ui::LatencyInfo&) OVERRIDE; + virtual void SwapBuffers(const ui::LatencyInfo&) OVERRIDE; private: // CompositorOutputSurface overrides. diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc index 43bd18e..6faa270 100644 --- a/content/renderer/gpu/render_widget_compositor.cc +++ b/content/renderer/gpu/render_widget_compositor.cc @@ -359,7 +359,7 @@ void RenderWidgetCompositor::SetNeedsRedrawRect(gfx::Rect damage_rect) { } void RenderWidgetCompositor::SetLatencyInfo( - const cc::LatencyInfo& latency_info) { + const ui::LatencyInfo& latency_info) { layer_tree_host_->SetLatencyInfo(latency_info); } diff --git a/content/renderer/gpu/render_widget_compositor.h b/content/renderer/gpu/render_widget_compositor.h index 192622b..cb49167 100644 --- a/content/renderer/gpu/render_widget_compositor.h +++ b/content/renderer/gpu/render_widget_compositor.h @@ -17,10 +17,13 @@ class SkPicture; +namespace ui { +struct LatencyInfo; +} + namespace cc { class InputHandler; class LayerTreeHost; -struct LatencyInfo; } namespace content { @@ -48,7 +51,7 @@ class RenderWidgetCompositor : public WebKit::WebLayerTreeView, bool animate); void SetOverdrawBottomHeight(float overdraw_bottom_height); void SetNeedsRedrawRect(gfx::Rect damage_rect); - void SetLatencyInfo(const cc::LatencyInfo& latency_info); + void SetLatencyInfo(const ui::LatencyInfo& latency_info); // WebLayerTreeView implementation. virtual void setSurfaceReady(); diff --git a/content/renderer/idle_user_detector.cc b/content/renderer/idle_user_detector.cc index 14a2923..0f138a8 100644 --- a/content/renderer/idle_user_detector.cc +++ b/content/renderer/idle_user_detector.cc @@ -26,7 +26,7 @@ bool IdleUserDetector::OnMessageReceived(const IPC::Message& message) { } void IdleUserDetector::OnHandleInputEvent(const WebKit::WebInputEvent* event, - const cc::LatencyInfo& latency_info, + const ui::LatencyInfo& latency_info, bool is_keyboard_shortcut) { if (GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { RenderThreadImpl* render_thread = RenderThreadImpl::current(); diff --git a/content/renderer/idle_user_detector.h b/content/renderer/idle_user_detector.h index 65107e3..500d8f75 100644 --- a/content/renderer/idle_user_detector.h +++ b/content/renderer/idle_user_detector.h @@ -12,7 +12,7 @@ namespace WebKit { class WebInputEvent; } -namespace cc { +namespace ui { struct LatencyInfo; } @@ -30,7 +30,7 @@ class IdleUserDetector : public RenderViewObserver { virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; void OnHandleInputEvent(const WebKit::WebInputEvent* event, - const cc::LatencyInfo& latency_info, + const ui::LatencyInfo& latency_info, bool is_keyboard_shortcut); DISALLOW_COPY_AND_ASSIGN(IdleUserDetector); diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 39b7b3f..d1ece39 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc @@ -716,7 +716,7 @@ void RenderWidget::OnViewContextSwapBuffersComplete() { } void RenderWidget::OnHandleInputEvent(const WebKit::WebInputEvent* input_event, - const cc::LatencyInfo& latency_info, + const ui::LatencyInfo& latency_info, bool is_keyboard_shortcut) { handling_input_event_ = true; if (!input_event) { diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index bfe776e..1d68065 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h @@ -291,7 +291,7 @@ class CONTENT_EXPORT RenderWidget // RenderWidget IPC message handlers void OnHandleInputEvent(const WebKit::WebInputEvent* event, - const cc::LatencyInfo& latency_info, + const ui::LatencyInfo& latency_info, bool keyboard_shortcut); void OnCursorVisibilityChange(bool is_visible); void OnMouseCaptureLost(); diff --git a/ui/base/OWNERS b/ui/base/OWNERS new file mode 100644 index 0000000..5ff0082 --- /dev/null +++ b/ui/base/OWNERS @@ -0,0 +1 @@ +per-file latency_info.*=jbauman@chromium.org diff --git a/ui/base/latency_info.cc b/ui/base/latency_info.cc new file mode 100644 index 0000000..2d37585 --- /dev/null +++ b/ui/base/latency_info.cc @@ -0,0 +1,66 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/base/latency_info.h" + +#include <algorithm> + +namespace ui { + +LatencyInfo::LatencyInfo() { +} + +LatencyInfo::~LatencyInfo() { +} + +void LatencyInfo::MergeWith(const LatencyInfo& other) { + for (LatencyMap::const_iterator it = other.latency_components.begin(); + it != other.latency_components.end(); + ++it) { + AddLatencyNumberWithTimestamp(it->first.first, + it->first.second, + it->second.sequence_number, + it->second.event_time, + it->second.event_count); + } +} + +void LatencyInfo::AddLatencyNumber(LatencyComponentType component, + int64 id, + int64 component_sequence_number) { + AddLatencyNumberWithTimestamp(component, id, component_sequence_number, + base::TimeTicks::Now(), 1); +} + +void LatencyInfo::AddLatencyNumberWithTimestamp(LatencyComponentType component, + int64 id, + int64 component_sequence_number, + base::TimeTicks time, + uint32 event_count) { + LatencyMap::key_type key = std::make_pair(component, id); + LatencyMap::iterator it = latency_components.find(key); + if (it == latency_components.end()) { + LatencyComponent info = {component_sequence_number, time, event_count}; + latency_components[key] = info; + return; + } + it->second.sequence_number = std::max(component_sequence_number, + it->second.sequence_number); + uint32 new_count = event_count + it->second.event_count; + if (event_count > 0 && new_count != 0) { + // Do a weighted average, so that the new event_time is the average of + // the times of events currently in this structure with the time passed + // into this method. + it->second.event_time += (time - it->second.event_time) * event_count / + new_count; + it->second.event_count = new_count; + } +} + +void LatencyInfo::Clear() { + latency_components.clear(); +} + +} // namespace ui + diff --git a/cc/debug/latency_info.h b/ui/base/latency_info.h index e967caf..718fbb4 100644 --- a/cc/debug/latency_info.h +++ b/ui/base/latency_info.h @@ -2,27 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CC_DEBUG_LATENCY_INFO_H_ -#define CC_DEBUG_LATENCY_INFO_H_ +#ifndef UI_BASE_LATENCY_INFO_H_ +#define UI_BASE_LATENCY_INFO_H_ #include <map> #include <utility> #include "base/basictypes.h" #include "base/time.h" -#include "cc/base/cc_export.h" +#include "ui/base/ui_export.h" -namespace cc { +namespace ui { enum LatencyComponentType { - kRendererMainThread, - kRendererImplThread, - kBrowserMainThread, - kBrowserImplThread, - kInputEvent, + INPUT_EVENT_LATENCY_COMPONENT, }; -struct CC_EXPORT LatencyInfo { +struct UI_EXPORT LatencyInfo { struct LatencyComponent { // Nondecreasing number that can be used to determine what events happened // in the component at the time this struct was sent on to the next @@ -39,28 +35,36 @@ struct CC_EXPORT LatencyInfo { typedef std::map<std::pair<LatencyComponentType, int64>, LatencyComponent> LatencyMap; - LatencyMap latency_components; - - // This represents the final time that a frame is displayed it. - base::TimeTicks swap_timestamp; - LatencyInfo(); ~LatencyInfo(); + // Merges the contents of another LatencyInfo into this one. void MergeWith(const LatencyInfo& other); - void AddLatencyNumber(LatencyComponentType component, int64 id, + // Modifies the current sequence number for a component, and adds a new + // sequence number with the current timestamp. + void AddLatencyNumber(LatencyComponentType component, + int64 id, int64 component_sequence_number); + + // Modifies the current sequence number and adds a certain number of events + // for a specific component. void AddLatencyNumberWithTimestamp(LatencyComponentType component, - int64 id, int64 component_sequence_number, + int64 id, + int64 component_sequence_number, base::TimeTicks time, uint32 event_count); void Clear(); + + LatencyMap latency_components; + + // This represents the final time that a frame is displayed it. + base::TimeTicks swap_timestamp; }; -} // namespace cc +} // namespace ui -#endif // CC_DEBUG_LATENCY_INFO_H_ +#endif // UI_BASE_LATENCY_INFO_H_ @@ -230,6 +230,8 @@ 'base/keycodes/keyboard_code_conversion_x.h', 'base/keycodes/keyboard_codes.h', 'base/keycodes/usb_keycode_map.h', + 'base/latency_info.cc', + 'base/latency_info.h', 'base/l10n/l10n_font_util.cc', 'base/l10n/l10n_font_util.h', 'base/l10n/l10n_util.cc', |