diff options
Diffstat (limited to 'cc')
-rw-r--r-- | cc/DEPS | 1 | ||||
-rw-r--r-- | cc/cc.gyp | 2 | ||||
-rw-r--r-- | cc/debug/latency_info.cc | 61 | ||||
-rw-r--r-- | cc/debug/latency_info.h | 66 | ||||
-rw-r--r-- | cc/output/compositor_frame_metadata.h | 4 | ||||
-rw-r--r-- | cc/output/delegating_renderer.cc | 2 | ||||
-rw-r--r-- | cc/output/delegating_renderer.h | 2 | ||||
-rw-r--r-- | cc/output/gl_renderer.cc | 2 | ||||
-rw-r--r-- | cc/output/gl_renderer.h | 2 | ||||
-rw-r--r-- | cc/output/gl_renderer_unittest.cc | 20 | ||||
-rw-r--r-- | cc/output/output_surface.cc | 4 | ||||
-rw-r--r-- | cc/output/output_surface.h | 7 | ||||
-rw-r--r-- | cc/output/renderer.h | 4 | ||||
-rw-r--r-- | cc/output/software_renderer.cc | 2 | ||||
-rw-r--r-- | cc/output/software_renderer.h | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_host.cc | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_host.h | 6 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.h | 4 | ||||
-rw-r--r-- | cc/trees/layer_tree_impl.cc | 4 | ||||
-rw-r--r-- | cc/trees/layer_tree_impl.h | 8 |
20 files changed, 39 insertions, 166 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/debug/latency_info.h b/cc/debug/latency_info.h deleted file mode 100644 index e967caf..0000000 --- a/cc/debug/latency_info.h +++ /dev/null @@ -1,66 +0,0 @@ -// 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. - -#ifndef CC_DEBUG_LATENCY_INFO_H_ -#define CC_DEBUG_LATENCY_INFO_H_ - -#include <map> -#include <utility> - -#include "base/basictypes.h" -#include "base/time.h" -#include "cc/base/cc_export.h" - -namespace cc { - -enum LatencyComponentType { - kRendererMainThread, - kRendererImplThread, - kBrowserMainThread, - kBrowserImplThread, - kInputEvent, -}; - -struct CC_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 - // component. - int64 sequence_number; - // Average time of events that happened in this component. - base::TimeTicks event_time; - // Count of events that happened in this component - uint32 event_count; - }; - - // Map a Latency Component (with a component-specific int64 id) to a - // component info. - 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(); - - void MergeWith(const LatencyInfo& other); - - void AddLatencyNumber(LatencyComponentType component, int64 id, - int64 component_sequence_number); - void AddLatencyNumberWithTimestamp(LatencyComponentType component, - int64 id, int64 component_sequence_number, - base::TimeTicks time, - uint32 event_count); - - void Clear(); -}; - -} // namespace cc - -#endif // CC_DEBUG_LATENCY_INFO_H_ - 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); }; |