diff options
30 files changed, 493 insertions, 293 deletions
diff --git a/cc/base/worker_pool.cc b/cc/base/worker_pool.cc index caa3159..25596d4 100644 --- a/cc/base/worker_pool.cc +++ b/cc/base/worker_pool.cc @@ -9,7 +9,6 @@ #include "base/stringprintf.h" #include "base/synchronization/condition_variable.h" #include "base/threading/simple_thread.h" -#include "cc/debug/rendering_stats.h" #if defined(OS_ANDROID) // TODO(epenner): Move thread priorities to base. (crbug.com/170549) @@ -29,13 +28,12 @@ class WorkerPoolTaskImpl : public internal::WorkerPoolTask { virtual bool IsCheap() OVERRIDE { return false; } - virtual void Run(RenderingStats* rendering_stats) OVERRIDE { - task_.Run(rendering_stats); + virtual void Run() OVERRIDE { + task_.Run(); } - virtual void RunOnThread( - RenderingStats* rendering_stats, unsigned thread_index) OVERRIDE { - task_.Run(rendering_stats); + virtual void RunOnThread(unsigned thread_index) OVERRIDE { + task_.Run(); } private: @@ -71,10 +69,6 @@ class WorkerPool::Inner : public base::DelegateSimpleThread::Delegate { void Shutdown(); - void SetRecordRenderingStats(bool record_rendering_stats); - - void GetRenderingStats(RenderingStats* stats); - void PostTask(scoped_ptr<internal::WorkerPoolTask> task, bool signal_workers); // Appends all completed tasks to worker pool's completed tasks queue @@ -149,8 +143,6 @@ class WorkerPool::Inner : public base::DelegateSimpleThread::Delegate { TaskDeque pending_tasks_; TaskDeque completed_tasks_; - scoped_ptr<RenderingStats> rendering_stats_; - ScopedPtrDeque<base::DelegateSimpleThread> workers_; DISALLOW_COPY_AND_ASSIGN(Inner); @@ -220,22 +212,6 @@ void WorkerPool::Inner::Shutdown() { } } -void WorkerPool::Inner::SetRecordRenderingStats(bool record_rendering_stats) { - base::AutoLock lock(lock_); - - if (record_rendering_stats) - rendering_stats_.reset(new RenderingStats); - else - rendering_stats_.reset(); -} - -void WorkerPool::Inner::GetRenderingStats(RenderingStats* stats) { - base::AutoLock lock(lock_); - - if (rendering_stats_) - stats->Add(*rendering_stats_); -} - void WorkerPool::Inner::PostTask(scoped_ptr<internal::WorkerPoolTask> task, bool signal_workers) { base::AutoLock lock(lock_); @@ -279,18 +255,13 @@ bool WorkerPool::Inner::RunCheapTasksUntilTimeLimit( break; } - scoped_ptr<RenderingStats> rendering_stats; - // Collect rendering stats if |rendering_stats_| is set. - if (rendering_stats_) - rendering_stats = make_scoped_ptr(new RenderingStats); - // Increment |running_task_count_| before starting to run task. running_task_count_++; { base::AutoUnlock unlock(lock_); - task->Run(rendering_stats.get()); + task->Run(); // Append tasks directly to worker pool's completed tasks queue. worker_pool_on_origin_thread_->completed_tasks_.push_back(task.Pass()); @@ -298,10 +269,6 @@ bool WorkerPool::Inner::RunCheapTasksUntilTimeLimit( worker_pool_on_origin_thread_->OnTaskCompleted(); } - // Add rendering stat results to |rendering_stats_|. - if (rendering_stats && rendering_stats_) - rendering_stats_->Add(*rendering_stats); - // Decrement |running_task_count_| now that we are done running task. running_task_count_--; } @@ -405,11 +372,6 @@ void WorkerPool::Inner::Run() { // Get next task. scoped_ptr<internal::WorkerPoolTask> task = pending_tasks_.take_front(); - scoped_ptr<RenderingStats> rendering_stats; - // Collect rendering stats if |rendering_stats_| is set. - if (rendering_stats_) - rendering_stats = make_scoped_ptr(new RenderingStats); - // Increment |running_task_count_| before starting to run task. running_task_count_++; @@ -420,15 +382,11 @@ void WorkerPool::Inner::Run() { { base::AutoUnlock unlock(lock_); - task->RunOnThread(rendering_stats.get(), thread_index); + task->RunOnThread(thread_index); } completed_tasks_.push_back(task.Pass()); - // Add rendering stat results to |rendering_stats_|. - if (rendering_stats && rendering_stats_) - rendering_stats_->Add(*rendering_stats); - // Decrement |running_task_count_| now that we are done running task. running_task_count_--; @@ -492,14 +450,6 @@ void WorkerPool::SetRunCheapTasksTimeLimit( ScheduleRunCheapTasks(); } -void WorkerPool::SetRecordRenderingStats(bool record_rendering_stats) { - inner_->SetRecordRenderingStats(record_rendering_stats); -} - -void WorkerPool::GetRenderingStats(RenderingStats* stats) { - inner_->GetRenderingStats(stats); -} - void WorkerPool::OnIdle() { TRACE_EVENT0("cc", "WorkerPool::OnIdle"); diff --git a/cc/base/worker_pool.h b/cc/base/worker_pool.h index 8e00b6b..af130f3 100644 --- a/cc/base/worker_pool.h +++ b/cc/base/worker_pool.h @@ -15,7 +15,6 @@ #include "cc/base/scoped_ptr_deque.h" namespace cc { -struct RenderingStats; namespace internal { @@ -25,10 +24,9 @@ class WorkerPoolTask { virtual bool IsCheap() = 0; - virtual void Run(RenderingStats* rendering_stats) = 0; + virtual void Run() = 0; - virtual void RunOnThread( - RenderingStats* rendering_stats, unsigned thread_index) = 0; + virtual void RunOnThread(unsigned thread_index) = 0; void DidComplete(); @@ -52,7 +50,7 @@ class CC_EXPORT WorkerPoolClient { // of all pending tasks at shutdown. class WorkerPool { public: - typedef base::Callback<void(RenderingStats*)> Callback; + typedef base::Callback<void()> Callback; virtual ~WorkerPool(); @@ -78,12 +76,6 @@ class WorkerPool { // Set time limit for running cheap tasks. void SetRunCheapTasksTimeLimit(base::TimeTicks run_cheap_tasks_time_limit); - // Toggle rendering stats collection. - void SetRecordRenderingStats(bool record_rendering_stats); - - // Collect rendering stats of all completed tasks. - void GetRenderingStats(RenderingStats* stats); - protected: WorkerPool(WorkerPoolClient* client, size_t num_threads, @@ -211,6 +211,8 @@ 'output/renderer.h', 'debug/rendering_stats.cc', 'debug/rendering_stats.h', + 'debug/rendering_stats_instrumentation.cc', + 'debug/rendering_stats_instrumentation.h', 'resources/resource.cc', 'resources/resource.h', 'resources/resource_pool.cc', diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp index 2d363f7..b625cce 100644 --- a/cc/cc_tests.gyp +++ b/cc/cc_tests.gyp @@ -99,6 +99,7 @@ 'test/fake_picture_layer_tiling_client.h', 'test/fake_proxy.cc', 'test/fake_proxy.h', + 'test/fake_rendering_stats_instrumentation.h', 'test/fake_scrollbar_layer.cc', 'test/fake_scrollbar_layer.h', 'test/fake_scrollbar_theme_painter.h', diff --git a/cc/debug/rendering_stats_instrumentation.cc b/cc/debug/rendering_stats_instrumentation.cc new file mode 100644 index 0000000..1fb5296 --- /dev/null +++ b/cc/debug/rendering_stats_instrumentation.cc @@ -0,0 +1,164 @@ +// 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 "cc/debug/rendering_stats_instrumentation.h" + +namespace cc { + +// static +scoped_ptr<RenderingStatsInstrumentation> + RenderingStatsInstrumentation::Create() { + return make_scoped_ptr(new RenderingStatsInstrumentation()); +} + +RenderingStatsInstrumentation::RenderingStatsInstrumentation() + : record_rendering_stats_(false) { +} + +RenderingStatsInstrumentation::~RenderingStatsInstrumentation() {} + +RenderingStats RenderingStatsInstrumentation::GetRenderingStats() { + base::AutoLock scoped_lock(lock_); + return rendering_stats_; +} + +base::TimeTicks RenderingStatsInstrumentation::StartRecording() const { + if (record_rendering_stats_) + return base::TimeTicks::HighResNow(); + return base::TimeTicks(); +} + +base::TimeDelta RenderingStatsInstrumentation::EndRecording( + base::TimeTicks start_time) const { + if (!start_time.is_null()) + return base::TimeTicks::HighResNow() - start_time; + return base::TimeDelta(); +} + +void RenderingStatsInstrumentation::AddStats(const RenderingStats& other) { + if (!record_rendering_stats_) + return; + + base::AutoLock scoped_lock(lock_); + rendering_stats_.Add(other); +} + +void RenderingStatsInstrumentation::IncrementAnimationFrameCount() { + if (!record_rendering_stats_) + return; + + base::AutoLock scoped_lock(lock_); + rendering_stats_.numAnimationFrames++; +} + +void RenderingStatsInstrumentation::SetScreenFrameCount(int64 count) { + if (!record_rendering_stats_) + return; + + base::AutoLock scoped_lock(lock_); + rendering_stats_.numFramesSentToScreen = count; +} + +void RenderingStatsInstrumentation::SetDroppedFrameCount(int64 count) { + if (!record_rendering_stats_) + return; + + base::AutoLock scoped_lock(lock_); + rendering_stats_.droppedFrameCount = count; +} + +void RenderingStatsInstrumentation::AddCommit(base::TimeDelta duration) { + if (!record_rendering_stats_) + return; + + base::AutoLock scoped_lock(lock_); + rendering_stats_.totalCommitTime += duration; + rendering_stats_.totalCommitCount++; +} + +void RenderingStatsInstrumentation::AddPaint(base::TimeDelta duration, + int64 pixels) { + if (!record_rendering_stats_) + return; + + base::AutoLock scoped_lock(lock_); + rendering_stats_.totalPaintTime += duration; + rendering_stats_.totalPixelsPainted += pixels; +} + +void RenderingStatsInstrumentation::AddRaster(base::TimeDelta duration, + int64 pixels, + bool is_in_pending_tree_now_bin) { + if (!record_rendering_stats_) + return; + + base::AutoLock scoped_lock(lock_); + rendering_stats_.totalRasterizeTime += duration; + rendering_stats_.totalPixelsRasterized += pixels; + + if (is_in_pending_tree_now_bin) + rendering_stats_.totalRasterizeTimeForNowBinsOnPendingTree += duration; +} + +void RenderingStatsInstrumentation::IncrementImplThreadScrolls() { + if (!record_rendering_stats_) + return; + + base::AutoLock scoped_lock(lock_); + rendering_stats_.numImplThreadScrolls++; +} + +void RenderingStatsInstrumentation::IncrementMainThreadScrolls() { + if (!record_rendering_stats_) + return; + + base::AutoLock scoped_lock(lock_); + rendering_stats_.numMainThreadScrolls++; +} + +void RenderingStatsInstrumentation::AddLayersDrawn(int64 amount) { + if (!record_rendering_stats_) + return; + + base::AutoLock scoped_lock(lock_); + rendering_stats_.numLayersDrawn += amount; +} + +void RenderingStatsInstrumentation::AddMissingTiles(int64 amount) { + if (!record_rendering_stats_) + return; + + base::AutoLock scoped_lock(lock_); + rendering_stats_.numMissingTiles += amount; +} + +void RenderingStatsInstrumentation::AddDeferredImageDecode( + base::TimeDelta duration) { + if (!record_rendering_stats_) + return; + + base::AutoLock scoped_lock(lock_); + rendering_stats_.totalDeferredImageDecodeTime += duration; + rendering_stats_.totalDeferredImageDecodeCount++; +} + +void RenderingStatsInstrumentation::AddImageGathering( + base::TimeDelta duration) { + if (!record_rendering_stats_) + return; + + base::AutoLock scoped_lock(lock_); + rendering_stats_.totalImageGatheringTime += duration; + rendering_stats_.totalImageGatheringCount++; +} + +void RenderingStatsInstrumentation::IncrementDeferredImageCacheHitCount() { + if (!record_rendering_stats_) + return; + + base::AutoLock scoped_lock(lock_); + rendering_stats_.totalDeferredImageCacheHitCount++; +} + +} // namespace cc diff --git a/cc/debug/rendering_stats_instrumentation.h b/cc/debug/rendering_stats_instrumentation.h new file mode 100644 index 0000000..63401c0 --- /dev/null +++ b/cc/debug/rendering_stats_instrumentation.h @@ -0,0 +1,74 @@ +// 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_RENDERING_STATS_INSTRUMENTATION_H_ +#define CC_RENDERING_STATS_INSTRUMENTATION_H_ + +#include "base/memory/scoped_ptr.h" +#include "base/synchronization/lock.h" +#include "cc/debug/rendering_stats.h" + +namespace cc { + +// RenderingStatsInstrumentation is shared among threads and manages conditional +// recording of rendering stats into a private RenderingStats instance. +class CC_EXPORT RenderingStatsInstrumentation { + public: + static scoped_ptr<RenderingStatsInstrumentation> Create(); + virtual ~RenderingStatsInstrumentation(); + + RenderingStats GetRenderingStats(); + + // Read and write access to the record_rendering_stats_ flag is not locked to + // improve performance. The flag is commonly turned off and hardly changes + // it's value during runtime. + bool record_rendering_stats() const { return record_rendering_stats_; } + void set_record_rendering_stats(bool record_rendering_stats) { + if (record_rendering_stats_ != record_rendering_stats) + record_rendering_stats_ = record_rendering_stats; + } + + base::TimeTicks StartRecording() const; + base::TimeDelta EndRecording(base::TimeTicks start_time) const; + + // TODO(egraether): Remove after switching Layer::update() to use this class. + // Used in LayerTreeHost::paintLayerContents(). + void AddStats(const RenderingStats& other); + + void IncrementAnimationFrameCount(); + void SetScreenFrameCount(int64 count); + void SetDroppedFrameCount(int64 count); + + void AddCommit(base::TimeDelta duration); + void AddPaint(base::TimeDelta duration, int64 pixels); + void AddRaster(base::TimeDelta duration, + int64 pixels, + bool is_in_pending_tree_now_bin); + + void IncrementImplThreadScrolls(); + void IncrementMainThreadScrolls(); + + void AddLayersDrawn(int64 amount); + void AddMissingTiles(int64 amount); + + void AddDeferredImageDecode(base::TimeDelta duration); + void AddImageGathering(base::TimeDelta duration); + + void IncrementDeferredImageCacheHitCount(); + + protected: + RenderingStatsInstrumentation(); + + private: + RenderingStats rendering_stats_; + bool record_rendering_stats_; + + base::Lock lock_; + + DISALLOW_COPY_AND_ASSIGN(RenderingStatsInstrumentation); +}; + +} // namespace cc + +#endif // CC_RENDERING_STATS_INSTRUMENTATION_H_ diff --git a/cc/layers/delegated_renderer_layer_impl_unittest.cc b/cc/layers/delegated_renderer_layer_impl_unittest.cc index a0f0bc6..a091a30 100644 --- a/cc/layers/delegated_renderer_layer_impl_unittest.cc +++ b/cc/layers/delegated_renderer_layer_impl_unittest.cc @@ -15,6 +15,7 @@ #include "cc/test/fake_layer_tree_host_impl_client.h" #include "cc/test/fake_output_surface.h" #include "cc/test/fake_proxy.h" +#include "cc/test/fake_rendering_stats_instrumentation.h" #include "cc/test/geometry_test_utils.h" #include "cc/test/mock_quad_culler.h" #include "cc/test/render_pass_test_common.h" @@ -37,7 +38,10 @@ class DelegatedRendererLayerImplTest : public testing::Test { LayerTreeSettings settings; settings.minimum_occlusion_tracking_size = gfx::Size(); - host_impl_ = LayerTreeHostImpl::Create(settings, &client_, &proxy_); + host_impl_ = LayerTreeHostImpl::Create(settings, + &client_, + &proxy_, + &stats_instrumentation_); host_impl_->InitializeRenderer(createFakeOutputSurface()); host_impl_->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); } @@ -47,6 +51,7 @@ class DelegatedRendererLayerImplTest : public testing::Test { FakeLayerTreeHostImplClient client_; DebugScopedSetImplThreadAndMainThreadBlocked always_impl_thread_and_main_thread_blocked_; + FakeRenderingStatsInstrumentation stats_instrumentation_; scoped_ptr<LayerTreeHostImpl> host_impl_; }; diff --git a/cc/resources/raster_worker_pool.cc b/cc/resources/raster_worker_pool.cc index 369a0e5..c2a4a0b 100644 --- a/cc/resources/raster_worker_pool.cc +++ b/cc/resources/raster_worker_pool.cc @@ -25,14 +25,12 @@ class RasterWorkerPoolTaskImpl : public internal::WorkerPoolTask { virtual bool IsCheap() OVERRIDE { return is_cheap_; } - virtual void Run(RenderingStats* rendering_stats) OVERRIDE { - task_.Run(picture_pile_.get(), rendering_stats); + virtual void Run() OVERRIDE { + task_.Run(picture_pile_.get()); } - virtual void RunOnThread( - RenderingStats* rendering_stats, unsigned thread_index) OVERRIDE { - task_.Run(picture_pile_->GetCloneForDrawingOnThread(thread_index), - rendering_stats); + virtual void RunOnThread(unsigned thread_index) OVERRIDE { + task_.Run(picture_pile_->GetCloneForDrawingOnThread(thread_index)); } private: diff --git a/cc/resources/raster_worker_pool.h b/cc/resources/raster_worker_pool.h index 4422860..0557946 100644 --- a/cc/resources/raster_worker_pool.h +++ b/cc/resources/raster_worker_pool.h @@ -15,7 +15,7 @@ class PicturePileImpl; // A worker thread pool that runs raster tasks. class RasterWorkerPool : public WorkerPool { public: - typedef base::Callback<void(PicturePileImpl*, RenderingStats*)> + typedef base::Callback<void(PicturePileImpl*)> RasterCallback; virtual ~RasterWorkerPool(); diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc index 61e112b..6fa8f910 100644 --- a/cc/resources/tile_manager.cc +++ b/cc/resources/tile_manager.cc @@ -152,7 +152,8 @@ TileManager::TileManager( size_t num_raster_threads, bool use_cheapness_estimator, bool use_color_estimator, - bool prediction_benchmarking) + bool prediction_benchmarking, + RenderingStatsInstrumentation* rendering_stats_instrumentation) : client_(client), resource_pool_(ResourcePool::Create(resource_provider)), raster_worker_pool_(RasterWorkerPool::Create(this, num_raster_threads)), @@ -161,12 +162,12 @@ TileManager::TileManager( bytes_pending_upload_(0), has_performed_uploads_since_last_flush_(false), ever_exceeded_memory_budget_(false), - record_rendering_stats_(false), use_cheapness_estimator_(use_cheapness_estimator), use_color_estimator_(use_color_estimator), prediction_benchmarking_(prediction_benchmarking), pending_tasks_(0), - max_pending_tasks_(kMaxNumPendingTasksPerThread * num_raster_threads) { + max_pending_tasks_(kMaxNumPendingTasksPerThread * num_raster_threads), + rendering_stats_instrumentation_(rendering_stats_instrumentation) { for (int i = 0; i < NUM_STATES; ++i) { for (int j = 0; j < NUM_TREES; ++j) { for (int k = 0; k < NUM_BINS; ++k) @@ -494,24 +495,6 @@ scoped_ptr<base::Value> TileManager::GetMemoryRequirementsAsValue() const { return requirements.PassAs<base::Value>(); } -void TileManager::SetRecordRenderingStats(bool record_rendering_stats) { - if (record_rendering_stats_ == record_rendering_stats) - return; - - record_rendering_stats_ = record_rendering_stats; - raster_worker_pool_->SetRecordRenderingStats(record_rendering_stats); -} - -void TileManager::GetRenderingStats(RenderingStats* stats) { - CHECK(record_rendering_stats_); - raster_worker_pool_->GetRenderingStats(stats); - stats->totalDeferredImageCacheHitCount = - rendering_stats_.totalDeferredImageCacheHitCount; - stats->totalImageGatheringCount = rendering_stats_.totalImageGatheringCount; - stats->totalImageGatheringTime = - rendering_stats_.totalImageGatheringTime; -} - bool TileManager::HasPendingWorkScheduled(WhichTree tree) const { // Always true when ManageTiles() call is pending. if (manage_tiles_pending_) @@ -738,19 +721,16 @@ void TileManager::GatherPixelRefsForTile(Tile* tile) { TRACE_EVENT0("cc", "TileManager::GatherPixelRefsForTile"); ManagedTileState& managed_tile_state = tile->managed_state(); if (managed_tile_state.need_to_gather_pixel_refs) { - base::TimeTicks gather_begin_time; - if (record_rendering_stats_) - gather_begin_time = base::TimeTicks::HighResNow(); + base::TimeTicks start_time = + rendering_stats_instrumentation_->StartRecording(); tile->picture_pile()->GatherPixelRefs( tile->content_rect_, tile->contents_scale_, managed_tile_state.pending_pixel_refs); managed_tile_state.need_to_gather_pixel_refs = false; - if (record_rendering_stats_) { - rendering_stats_.totalImageGatheringCount++; - rendering_stats_.totalImageGatheringTime += - base::TimeTicks::HighResNow() - gather_begin_time; - } + base::TimeDelta duration = + rendering_stats_instrumentation_->EndRecording(start_time); + rendering_stats_instrumentation_->AddImageGathering(duration); } } @@ -767,7 +747,7 @@ void TileManager::DispatchImageDecodeTasksForTile(Tile* tile) { } // TODO(qinmin): passing correct image size to PrepareToDecode(). if ((*it)->PrepareToDecode(skia::LazyPixelRef::PrepareParams())) { - rendering_stats_.totalDeferredImageCacheHitCount++; + rendering_stats_instrumentation_->IncrementDeferredImageCacheHitCount(); pending_pixel_refs.erase(it++); } else { if (pending_tasks_ >= max_pending_tasks_) @@ -787,7 +767,9 @@ void TileManager::DispatchOneImageDecodeTask( pending_decode_tasks_[pixel_ref_id] = pixel_ref; raster_worker_pool_->PostTaskAndReply( - base::Bind(&TileManager::RunImageDecodeTask, pixel_ref), + base::Bind(&TileManager::RunImageDecodeTask, + pixel_ref, + rendering_stats_instrumentation_), base::Bind(&TileManager::OnImageDecodeTaskCompleted, base::Unretained(this), tile, @@ -862,7 +844,8 @@ void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) { buffer, tile->content_rect(), tile->contents_scale(), - GetRasterTaskMetadata(*tile)), + GetRasterTaskMetadata(*tile), + rendering_stats_instrumentation_), base::Bind(&TileManager::OnRasterTaskCompleted, base::Unretained(this), tile, @@ -972,12 +955,13 @@ void TileManager::DidTileTreeBinChange(Tile* tile, } // static -void TileManager::RunRasterTask(uint8* buffer, - const gfx::Rect& rect, - float contents_scale, - const RasterTaskMetadata& metadata, - PicturePileImpl* picture_pile, - RenderingStats* stats) { +void TileManager::RunRasterTask( + uint8* buffer, + const gfx::Rect& rect, + float contents_scale, + const RasterTaskMetadata& metadata, + RenderingStatsInstrumentation* stats_instrumentation, + PicturePileImpl* picture_pile) { TRACE_EVENT2( "cc", "TileManager::RunRasterTask", "is_on_pending_tree", @@ -995,22 +979,18 @@ void TileManager::RunRasterTask(uint8* buffer, SkDevice device(bitmap); SkCanvas canvas(&device); - base::TimeTicks begin_time; - if (stats) - begin_time = base::TimeTicks::HighResNow(); + base::TimeTicks start_time = stats_instrumentation->StartRecording(); int64 total_pixels_rasterized = 0; picture_pile->Raster(&canvas, rect, contents_scale, &total_pixels_rasterized); - if (stats) { - stats->totalPixelsRasterized += total_pixels_rasterized; + base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); - base::TimeTicks end_time = base::TimeTicks::HighResNow(); - base::TimeDelta duration = end_time - begin_time; - stats->totalRasterizeTime += duration; - if (metadata.is_tile_in_pending_tree_now_bin) - stats->totalRasterizeTimeForNowBinsOnPendingTree += duration; + if (stats_instrumentation->record_rendering_stats()) { + stats_instrumentation->AddRaster(duration, + total_pixels_rasterized, + metadata.is_tile_in_pending_tree_now_bin); UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.PictureRasterTimeMS", duration.InMilliseconds(), @@ -1103,18 +1083,14 @@ void TileManager::RecordSolidColorPredictorResults( } // static -void TileManager::RunImageDecodeTask(skia::LazyPixelRef* pixel_ref, - RenderingStats* stats) { +void TileManager::RunImageDecodeTask( + skia::LazyPixelRef* pixel_ref, + RenderingStatsInstrumentation* stats_instrumentation) { TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); - base::TimeTicks decode_begin_time; - if (stats) - decode_begin_time = base::TimeTicks::HighResNow(); + base::TimeTicks start_time = stats_instrumentation->StartRecording(); pixel_ref->Decode(); - if (stats) { - stats->totalDeferredImageDecodeCount++; - stats->totalDeferredImageDecodeTime += - base::TimeTicks::HighResNow() - decode_begin_time; - } + base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); + stats_instrumentation->AddDeferredImageDecode(duration); } } // namespace cc diff --git a/cc/resources/tile_manager.h b/cc/resources/tile_manager.h index 85cb7c1..76c2b89 100644 --- a/cc/resources/tile_manager.h +++ b/cc/resources/tile_manager.h @@ -14,7 +14,7 @@ #include "base/memory/scoped_ptr.h" #include "base/values.h" #include "cc/base/worker_pool.h" -#include "cc/debug/rendering_stats.h" +#include "cc/debug/rendering_stats_instrumentation.h" #include "cc/resources/memory_history.h" #include "cc/resources/picture_pile_impl.h" #include "cc/resources/resource_pool.h" @@ -78,7 +78,8 @@ class CC_EXPORT TileManager : public WorkerPoolClient { size_t num_raster_threads, bool use_cheapess_estimator, bool use_color_estimator, - bool prediction_benchmarking); + bool prediction_benchmarking, + RenderingStatsInstrumentation* rendering_stats_instrumentation); virtual ~TileManager(); const GlobalStateThatImpactsTilePriority& GlobalState() const { @@ -94,11 +95,9 @@ class CC_EXPORT TileManager : public WorkerPoolClient { scoped_ptr<base::Value> BasicStateAsValue() const; scoped_ptr<base::Value> AllTilesAsValue() const; - void GetMemoryStats(size_t* memory_required_bytes, - size_t* memory_nice_to_have_bytes, - size_t* memory_used_bytes) const; - void SetRecordRenderingStats(bool record_rendering_stats); - void GetRenderingStats(RenderingStats* stats); + void GetMemoryStats(size_t* memoryRequiredBytes, + size_t* memoryNiceToHaveBytes, + size_t* memoryUsedBytes) const; bool HasPendingWorkScheduled(WhichTree tree) const; const MemoryHistory::Entry& memory_stats_from_last_assign() const { @@ -165,14 +164,16 @@ class CC_EXPORT TileManager : public WorkerPoolClient { WhichTree tree); scoped_ptr<Value> GetMemoryRequirementsAsValue() const; - static void RunRasterTask(uint8* buffer, - const gfx::Rect& rect, - float contents_scale, - const RasterTaskMetadata& metadata, - PicturePileImpl* picture_pile, - RenderingStats* stats); - static void RunImageDecodeTask(skia::LazyPixelRef* pixel_ref, - RenderingStats* stats); + static void RunRasterTask( + uint8* buffer, + const gfx::Rect& rect, + float contents_scale, + const RasterTaskMetadata& metadata, + RenderingStatsInstrumentation* stats_instrumentation, + PicturePileImpl* picture_pile); + static void RunImageDecodeTask( + skia::LazyPixelRef* pixel_ref, + RenderingStatsInstrumentation* stats_instrumentation); static void RecordCheapnessPredictorResults(bool is_predicted_cheap, bool is_actually_cheap); @@ -211,8 +212,7 @@ class CC_EXPORT TileManager : public WorkerPoolClient { bool ever_exceeded_memory_budget_; MemoryHistory::Entry memory_stats_from_last_assign_; - bool record_rendering_stats_; - RenderingStats rendering_stats_; + RenderingStatsInstrumentation* rendering_stats_instrumentation_; bool use_cheapness_estimator_; bool use_color_estimator_; diff --git a/cc/test/fake_layer_tree_host_impl.cc b/cc/test/fake_layer_tree_host_impl.cc index 334ff9f..f393f1d 100644 --- a/cc/test/fake_layer_tree_host_impl.cc +++ b/cc/test/fake_layer_tree_host_impl.cc @@ -7,7 +7,11 @@ namespace cc { FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy) - : LayerTreeHostImpl(LayerTreeSettings(), &client_, proxy) { + : LayerTreeHostImpl(LayerTreeSettings(), + &client_, + proxy, + &stats_instrumentation_) +{ // Explicitly clear all debug settings. SetDebugState(LayerTreeDebugState()); } @@ -15,7 +19,11 @@ FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy) FakeLayerTreeHostImpl::FakeLayerTreeHostImpl( const LayerTreeSettings& settings, Proxy* proxy) - : LayerTreeHostImpl(settings, &client_, proxy) { + : LayerTreeHostImpl(settings, + &client_, + proxy, + &stats_instrumentation_) +{ // Explicitly clear all debug settings. SetDebugState(LayerTreeDebugState()); } diff --git a/cc/test/fake_layer_tree_host_impl.h b/cc/test/fake_layer_tree_host_impl.h index 2023411..8ed07e8 100644 --- a/cc/test/fake_layer_tree_host_impl.h +++ b/cc/test/fake_layer_tree_host_impl.h @@ -6,6 +6,7 @@ #define CC_TEST_FAKE_LAYER_TREE_HOST_IMPL_H_ #include "cc/test/fake_layer_tree_host_impl_client.h" +#include "cc/test/fake_rendering_stats_instrumentation.h" #include "cc/trees/layer_tree_host_impl.h" #include "cc/trees/single_thread_proxy.h" @@ -27,6 +28,7 @@ class FakeLayerTreeHostImpl : public LayerTreeHostImpl { private: FakeLayerTreeHostImplClient client_; + FakeRenderingStatsInstrumentation stats_instrumentation_; }; } // namespace cc diff --git a/cc/test/fake_picture_layer_tiling_client.cc b/cc/test/fake_picture_layer_tiling_client.cc index 45c2640..2e96de6 100644 --- a/cc/test/fake_picture_layer_tiling_client.cc +++ b/cc/test/fake_picture_layer_tiling_client.cc @@ -20,7 +20,13 @@ class FakeInfinitePicturePileImpl : public PicturePileImpl { }; FakePictureLayerTilingClient::FakePictureLayerTilingClient() - : tile_manager_(&tile_manager_client_, NULL, 1, false, false, false), + : tile_manager_(&tile_manager_client_, + NULL, + 1, + false, + false, + false, + &stats_instrumentation_), pile_(new FakeInfinitePicturePileImpl()) { } diff --git a/cc/test/fake_picture_layer_tiling_client.h b/cc/test/fake_picture_layer_tiling_client.h index 9f2e77d..0dd9717 100644 --- a/cc/test/fake_picture_layer_tiling_client.h +++ b/cc/test/fake_picture_layer_tiling_client.h @@ -9,6 +9,7 @@ #include "cc/resources/picture_pile_impl.h" #include "cc/resources/tile.h" #include "cc/resources/tile_manager.h" +#include "cc/test/fake_rendering_stats_instrumentation.h" #include "cc/test/fake_tile_manager_client.h" #include "ui/gfx/rect.h" @@ -32,6 +33,7 @@ class FakePictureLayerTilingClient : public PictureLayerTilingClient { protected: FakeTileManagerClient tile_manager_client_; + FakeRenderingStatsInstrumentation stats_instrumentation_; TileManager tile_manager_; scoped_refptr<PicturePileImpl> pile_; gfx::Size tile_size_; diff --git a/cc/test/fake_proxy.h b/cc/test/fake_proxy.h index 3b84723..3be3f46 100644 --- a/cc/test/fake_proxy.h +++ b/cc/test/fake_proxy.h @@ -28,7 +28,6 @@ class FakeProxy : public Proxy { virtual void SetVisible(bool visible) OVERRIDE {} virtual bool InitializeRenderer() OVERRIDE; virtual bool RecreateOutputSurface() OVERRIDE; - virtual void CollectRenderingStats(RenderingStats* stats) OVERRIDE {} virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE; virtual void SetNeedsAnimate() OVERRIDE {} virtual void SetNeedsCommit() OVERRIDE {} diff --git a/cc/test/fake_rendering_stats_instrumentation.h b/cc/test/fake_rendering_stats_instrumentation.h new file mode 100644 index 0000000..d32e4a0 --- /dev/null +++ b/cc/test/fake_rendering_stats_instrumentation.h @@ -0,0 +1,20 @@ +// 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_TEST_FAKE_RENDERING_STATS_INSTRUMENTATION_H_ +#define CC_TEST_FAKE_RENDERING_STATS_INSTRUMENTATION_H_ + +#include "cc/debug/rendering_stats_instrumentation.h" + +namespace cc { + +class FakeRenderingStatsInstrumentation : public RenderingStatsInstrumentation { + public: + FakeRenderingStatsInstrumentation() {} + virtual ~FakeRenderingStatsInstrumentation() {} +}; + +} // namespace cc + +#endif // CC_TEST_FAKE_RENDERING_STATS_INSTRUMENTATION_H_ diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index bd281bc..f4f421d 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc @@ -69,19 +69,27 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { TestHooks* test_hooks, const LayerTreeSettings& settings, LayerTreeHostImplClient* host_impl_client, - Proxy* proxy) { - return make_scoped_ptr(new LayerTreeHostImplForTesting(test_hooks, - settings, - host_impl_client, - proxy)); + Proxy* proxy, + RenderingStatsInstrumentation* stats_instrumentation) { + return make_scoped_ptr( + new LayerTreeHostImplForTesting(test_hooks, + settings, + host_impl_client, + proxy, + stats_instrumentation)); } protected: - LayerTreeHostImplForTesting(TestHooks* test_hooks, - const LayerTreeSettings& settings, - LayerTreeHostImplClient* host_impl_client, - Proxy* proxy) - : LayerTreeHostImpl(settings, host_impl_client, proxy), + LayerTreeHostImplForTesting( + TestHooks* test_hooks, + const LayerTreeSettings& settings, + LayerTreeHostImplClient* host_impl_client, + Proxy* proxy, + RenderingStatsInstrumentation* stats_instrumentation) + : LayerTreeHostImpl(settings, + host_impl_client, + proxy, + stats_instrumentation), test_hooks_(test_hooks) {} virtual void BeginCommit() OVERRIDE { @@ -191,7 +199,8 @@ class LayerTreeHostForTesting : public cc::LayerTreeHost { test_hooks_, settings(), host_impl_client, - proxy()).PassAs<cc::LayerTreeHostImpl>(); + proxy(), + rendering_stats_instrumentation()).PassAs<cc::LayerTreeHostImpl>(); } virtual void SetNeedsCommit() OVERRIDE { diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index dbad9ac..b023f85 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc @@ -15,6 +15,7 @@ #include "cc/base/math_util.h" #include "cc/base/thread.h" #include "cc/debug/overdraw_metrics.h" +#include "cc/debug/rendering_stats_instrumentation.h" #include "cc/input/pinch_zoom_scrollbar.h" #include "cc/input/pinch_zoom_scrollbar_geometry.h" #include "cc/input/pinch_zoom_scrollbar_painter.h" @@ -77,7 +78,7 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, needs_filter_context_(false), client_(client), commit_number_(0), - rendering_stats_(), + rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), renderer_initialized_(false), output_surface_lost_(false), num_failed_recreate_attempts_(0), @@ -95,6 +96,9 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, if (settings_.accelerated_animation_enabled) animation_registrar_ = AnimationRegistrar::Create(); s_num_layer_tree_instances++; + + rendering_stats_instrumentation_->set_record_rendering_stats( + debug_state_.RecordRenderingStats()); } bool LayerTreeHost::Initialize(scoped_ptr<Thread> impl_thread) { @@ -230,7 +234,7 @@ void LayerTreeHost::UpdateAnimations(base::TimeTicks frame_begin_time) { AnimateLayers(frame_begin_time); animating_ = false; - rendering_stats_.numAnimationFrames++; + rendering_stats_instrumentation_->IncrementAnimationFrameCount(); } void LayerTreeHost::DidStopFlinging() { @@ -345,8 +349,12 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) { sync_tree->DidBecomeActive(); } - if (debug_state_.continuous_painting) - host_impl->SavePaintTime(rendering_stats_.totalPaintTime, commit_number()); + if (debug_state_.continuous_painting) { + host_impl->SavePaintTime( + rendering_stats_instrumentation_->GetRenderingStats().totalPaintTime, + commit_number() + ); + } commit_number_++; } @@ -443,7 +451,10 @@ scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( LayerTreeHostImplClient* client) { DCHECK(proxy_->IsImplThread()); scoped_ptr<LayerTreeHostImpl> host_impl = - LayerTreeHostImpl::Create(settings_, client, proxy_.get()); + LayerTreeHostImpl::Create(settings_, + client, + proxy_.get(), + rendering_stats_instrumentation_.get()); if (settings_.calculate_top_controls_position && host_impl->top_controls_manager()) { top_controls_manager_weak_ptr_ = @@ -482,8 +493,7 @@ void LayerTreeHost::DidDeferCommit() {} void LayerTreeHost::CollectRenderingStats(RenderingStats* stats) const { CHECK(debug_state_.RecordRenderingStats()); - *stats = rendering_stats_; - proxy_->CollectRenderingStats(stats); + *stats = rendering_stats_instrumentation_->GetRenderingStats(); } const RendererCapabilities& LayerTreeHost::GetRendererCapabilities() const { @@ -557,6 +567,10 @@ void LayerTreeHost::SetDebugState(const LayerTreeDebugState& debug_state) { return; debug_state_ = new_debug_state; + + rendering_stats_instrumentation_->set_record_rendering_stats( + debug_state_.RecordRenderingStats()); + SetNeedsCommit(); } @@ -796,15 +810,13 @@ size_t LayerTreeHost::CalculateMemoryForRenderSurfaces( } bool LayerTreeHost::PaintMasksForRenderSurface(Layer* render_surface_layer, - ResourceUpdateQueue* queue) { + ResourceUpdateQueue* queue, + RenderingStats* stats) { // Note: Masks and replicas only exist for layers that own render surfaces. If // we reach this point in code, we already know that at least something will // be drawn into this render surface, so the mask and replica should be // painted. - RenderingStats* stats = - debug_state_.RecordRenderingStats() ? &rendering_stats_ : NULL; - bool need_more_updates = false; Layer* mask_layer = render_surface_layer->mask_layer(); if (mask_layer) { @@ -844,8 +856,10 @@ bool LayerTreeHost::PaintLayerContents( PrioritizeTextures(render_surface_layer_list, occlusion_tracker.overdraw_metrics()); - RenderingStats* stats = debug_state_.RecordRenderingStats() ? - &rendering_stats_ : NULL; + // TODO(egraether): Use RenderingStatsInstrumentation in Layer::update() + RenderingStats stats; + RenderingStats* stats_ptr = + debug_state_.RecordRenderingStats() ? &stats : NULL; LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list); for (LayerIteratorType it = @@ -857,16 +871,18 @@ bool LayerTreeHost::PaintLayerContents( if (it.represents_target_render_surface()) { DCHECK(it->render_surface()->draw_opacity() || it->render_surface()->draw_opacity_is_animating()); - need_more_updates |= PaintMasksForRenderSurface(*it, queue); + need_more_updates |= PaintMasksForRenderSurface(*it, queue, stats_ptr); } else if (it.represents_itself()) { DCHECK(!it->bounds().IsEmpty()); - it->Update(queue, &occlusion_tracker, stats); + it->Update(queue, &occlusion_tracker, stats_ptr); need_more_updates |= it->NeedMoreUpdates(); } occlusion_tracker.LeaveLayer(it); } + rendering_stats_instrumentation_->AddStats(stats); + occlusion_tracker.overdraw_metrics()->RecordMetrics(this); return need_more_updates; diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index ea769aa..934ae46 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h @@ -17,7 +17,6 @@ #include "cc/animation/animation_events.h" #include "cc/base/cc_export.h" #include "cc/base/scoped_ptr_vector.h" -#include "cc/debug/rendering_stats.h" #include "cc/output/output_surface.h" #include "cc/scheduler/rate_limiter.h" #include "cc/trees/layer_tree_host_client.h" @@ -51,10 +50,12 @@ class LayerTreeHostImplClient; class PrioritizedResourceManager; class PrioritizedResource; class Region; +class RenderingStatsInstrumentation; class ResourceProvider; class ResourceUpdateQueue; class ScrollbarLayer; class TopControlsManager; +struct RenderingStats; struct ScrollAndScaleSet; // Provides information on an Impl's rendering capabilities back to the @@ -148,6 +149,10 @@ class CC_EXPORT LayerTreeHost : public RateLimiterClient { void CollectRenderingStats(RenderingStats* stats) const; + RenderingStatsInstrumentation* rendering_stats_instrumentation() const { + return rendering_stats_instrumentation_.get(); + } + const RendererCapabilities& GetRendererCapabilities() const; void SetNeedsAnimate(); @@ -247,7 +252,8 @@ class CC_EXPORT LayerTreeHost : public RateLimiterClient { bool PaintLayerContents(const LayerList& render_surface_layer_list, ResourceUpdateQueue* quue); bool PaintMasksForRenderSurface(Layer* render_surface_layer, - ResourceUpdateQueue* queue); + ResourceUpdateQueue* queue, + RenderingStats* stats); void UpdateLayers(Layer* root_layer, ResourceUpdateQueue* queue); void UpdateHudLayer(); @@ -275,7 +281,7 @@ class CC_EXPORT LayerTreeHost : public RateLimiterClient { scoped_ptr<Proxy> proxy_; int commit_number_; - RenderingStats rendering_stats_; + scoped_ptr<RenderingStatsInstrumentation> rendering_stats_instrumentation_; bool renderer_initialized_; bool output_surface_lost_; diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 327e26e..4dee1b3 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -19,7 +19,7 @@ #include "cc/debug/frame_rate_counter.h" #include "cc/debug/overdraw_metrics.h" #include "cc/debug/paint_time_counter.h" -#include "cc/debug/rendering_stats.h" +#include "cc/debug/rendering_stats_instrumentation.h" #include "cc/input/page_scale_animation.h" #include "cc/input/top_controls_manager.h" #include "cc/layers/append_quads_data.h" @@ -141,13 +141,20 @@ LayerTreeHostImpl::FrameData::~FrameData() {} scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( const LayerTreeSettings& settings, LayerTreeHostImplClient* client, - Proxy* proxy) { - return make_scoped_ptr(new LayerTreeHostImpl(settings, client, proxy)); + Proxy* proxy, + RenderingStatsInstrumentation* rendering_stats_instrumentation) { + return make_scoped_ptr( + new LayerTreeHostImpl(settings, + client, + proxy, + rendering_stats_instrumentation)); } -LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, - LayerTreeHostImplClient* client, - Proxy* proxy) +LayerTreeHostImpl::LayerTreeHostImpl( + const LayerTreeSettings& settings, + LayerTreeHostImplClient* client, + Proxy* proxy, + RenderingStatsInstrumentation* rendering_stats_instrumentation) : client_(client), proxy_(proxy), did_lock_scrolling_layer_(false), @@ -166,14 +173,11 @@ LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, paint_time_counter_(PaintTimeCounter::Create()), memory_history_(MemoryHistory::Create()), debug_rect_history_(DebugRectHistory::Create()), - num_impl_thread_scrolls_(0), - num_main_thread_scrolls_(0), - cumulative_num_layers_drawn_(0), - cumulative_num_missing_tiles_(0), last_sent_memory_visible_bytes_(0), last_sent_memory_visible_and_nearby_bytes_(0), last_sent_memory_use_bytes_(0), - animation_registrar_(AnimationRegistrar::Create()) { + animation_registrar_(AnimationRegistrar::Create()), + rendering_stats_instrumentation_(rendering_stats_instrumentation) { DCHECK(proxy_->IsImplThread()); DidVisibilityChange(this, visible_); @@ -540,6 +544,8 @@ bool LayerTreeHostImpl::CalculateRenderPasses(FrameData* frame) { // texture suddenly appearing in the future. bool draw_frame = true; + int layers_drawn = 0; + LayerIteratorType end = LayerIteratorType::End(frame->render_surface_layer_list); for (LayerIteratorType it = @@ -608,14 +614,15 @@ bool LayerTreeHostImpl::CalculateRenderPasses(FrameData* frame) { &append_quads_data); } - ++cumulative_num_layers_drawn_; + ++layers_drawn; } if (append_quads_data.hadOcclusionFromOutsideTargetSurface) target_render_pass->has_occlusion_from_outside_target_surface = true; if (append_quads_data.numMissingTiles) { - cumulative_num_missing_tiles_ += append_quads_data.numMissingTiles; + rendering_stats_instrumentation_->AddMissingTiles( + append_quads_data.numMissingTiles); bool layer_has_animating_transform = it->screen_space_transform_is_animating() || it->draw_transform_is_animating(); @@ -629,6 +636,8 @@ bool LayerTreeHostImpl::CalculateRenderPasses(FrameData* frame) { occlusion_tracker.LeaveLayer(it); } + rendering_stats_instrumentation_->AddLayersDrawn(layers_drawn); + #ifndef NDEBUG for (size_t i = 0; i < frame->render_passes.size(); ++i) { for (size_t j = 0; j < frame->render_passes[i]->quad_list.size(); ++j) @@ -944,6 +953,11 @@ void LayerTreeHostImpl::DrawLayers(FrameData* frame, fps_counter_->SaveTimeStamp(frame_begin_time); + rendering_stats_instrumentation_->SetScreenFrameCount( + fps_counter_->current_frame_number()); + rendering_stats_instrumentation_->SetDroppedFrameCount( + fps_counter_->dropped_frame_count()); + if (tile_manager_) { memory_history_->SaveEntry( tile_manager_->memory_stats_from_last_assign()); @@ -1174,8 +1188,8 @@ void LayerTreeHostImpl::ActivatePendingTree() { client_->RenewTreePriority(); if (tile_manager_ && debug_state_.continuous_painting) { - RenderingStats stats; - tile_manager_->GetRenderingStats(&stats); + RenderingStats stats = + rendering_stats_instrumentation_->GetRenderingStats(); paint_time_counter_->SaveRasterizeTime( stats.totalRasterizeTimeForNowBinsOnPendingTree, active_tree_->source_frame_number()); @@ -1235,8 +1249,8 @@ bool LayerTreeHostImpl::InitializeRenderer( settings_.num_raster_threads, settings_.use_cheapness_estimator, settings_.use_color_estimator, - settings_.prediction_benchmarking)); - tile_manager_->SetRecordRenderingStats(debug_state_.RecordRenderingStats()); + settings_.prediction_benchmarking, + rendering_stats_instrumentation_)); } if (output_surface->capabilities().has_parent_compositor) { @@ -1361,7 +1375,7 @@ InputHandlerClient::ScrollStatus LayerTreeHostImpl::ScrollBegin( // thread. ScrollStatus status = layer_impl->TryScroll(device_viewport_point, type); if (status == ScrollOnMainThread) { - num_main_thread_scrolls_++; + rendering_stats_instrumentation_->IncrementMainThreadScrolls(); UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); active_tree()->DidBeginScroll(); return ScrollOnMainThread; @@ -1375,7 +1389,7 @@ InputHandlerClient::ScrollStatus LayerTreeHostImpl::ScrollBegin( // If any layer wants to divert the scroll event to the main thread, abort. if (status == ScrollOnMainThread) { - num_main_thread_scrolls_++; + rendering_stats_instrumentation_->IncrementMainThreadScrolls(); UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); active_tree()->DidBeginScroll(); return ScrollOnMainThread; @@ -1399,7 +1413,7 @@ InputHandlerClient::ScrollStatus LayerTreeHostImpl::ScrollBegin( potentially_scrolling_layer_impl); should_bubble_scrolls_ = (type != NonBubblingGesture); wheel_scrolling_ = (type == Wheel); - num_impl_thread_scrolls_++; + rendering_stats_instrumentation_->IncrementImplThreadScrolls(); client_->RenewTreePriority(); UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false); active_tree()->DidBeginScroll(); @@ -1795,18 +1809,6 @@ int LayerTreeHostImpl::SourceAnimationFrameNumber() const { return fps_counter_->current_frame_number(); } -void LayerTreeHostImpl::CollectRenderingStats(RenderingStats* stats) const { - stats->numFramesSentToScreen = fps_counter_->current_frame_number(); - stats->droppedFrameCount = fps_counter_->dropped_frame_count(); - stats->numImplThreadScrolls = num_impl_thread_scrolls_; - stats->numMainThreadScrolls = num_main_thread_scrolls_; - stats->numLayersDrawn = cumulative_num_layers_drawn_; - stats->numMissingTiles = cumulative_num_missing_tiles_; - - if (tile_manager_) - tile_manager_->GetRenderingStats(stats); -} - void LayerTreeHostImpl::SendManagedMemoryStats( size_t memory_visible_bytes, size_t memory_visible_and_nearby_bytes, @@ -1961,9 +1963,6 @@ void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { paint_time_counter_->ClearHistory(); debug_state_ = debug_state; - - if (tile_manager_) - tile_manager_->SetRecordRenderingStats(debug_state_.RecordRenderingStats()); } void LayerTreeHostImpl::SavePaintTime(const base::TimeDelta& total_paint_time, diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index 749048d..2f46068 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h @@ -35,11 +35,11 @@ class LayerTreeImpl; class PageScaleAnimation; class PaintTimeCounter; class MemoryHistory; +class RenderingStatsInstrumentation; class RenderPassDrawQuad; class ResourceProvider; class TopControlsManager; struct RendererCapabilities; -struct RenderingStats; // LayerTreeHost->Proxy callback interface. class LayerTreeHostImplClient { @@ -81,7 +81,8 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, static scoped_ptr<LayerTreeHostImpl> Create( const LayerTreeSettings& settings, LayerTreeHostImplClient* client, - Proxy* proxy); + Proxy* proxy, + RenderingStatsInstrumentation* rendering_stats_instrumentation); virtual ~LayerTreeHostImpl(); // InputHandlerClient implementation @@ -238,8 +239,6 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, return !animation_registrar_->active_animation_controllers().empty(); } - void CollectRenderingStats(RenderingStats* stats) const; - void SendManagedMemoryStats( size_t memory_visible_bytes, size_t memory_visible_and_nearby_bytes, @@ -329,9 +328,11 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, bool page_scale_animation_active() const { return !!page_scale_animation_; } protected: - LayerTreeHostImpl(const LayerTreeSettings& settings, - LayerTreeHostImplClient* client, - Proxy* proxy); + LayerTreeHostImpl( + const LayerTreeSettings& settings, + LayerTreeHostImplClient* client, + Proxy* proxy, + RenderingStatsInstrumentation* rendering_stats_instrumentation); void ActivatePendingTree(); // Virtual for testing. @@ -448,6 +449,8 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, scoped_ptr<AnimationRegistrar> animation_registrar_; + RenderingStatsInstrumentation* rendering_stats_instrumentation_; + DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); }; diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index b835bc5..814260f 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -32,6 +32,7 @@ #include "cc/test/animation_test_common.h" #include "cc/test/fake_output_surface.h" #include "cc/test/fake_proxy.h" +#include "cc/test/fake_rendering_stats_instrumentation.h" #include "cc/test/fake_video_frame_provider.h" #include "cc/test/fake_web_scrollbar_theme_geometry.h" #include "cc/test/geometry_test_utils.h" @@ -78,7 +79,7 @@ public: LayerTreeSettings settings; settings.minimum_occlusion_tracking_size = gfx::Size(); - m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy); + m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy, &m_statsInstrumentation); m_hostImpl->InitializeRenderer(createOutputSurface()); m_hostImpl->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); } @@ -112,7 +113,7 @@ public: settings.minimum_occlusion_tracking_size = gfx::Size(); settings.partial_swap_enabled = partialSwap; - m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy); + m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy, &m_statsInstrumentation); m_hostImpl->InitializeRenderer(outputSurface.Pass()); m_hostImpl->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); @@ -224,6 +225,7 @@ protected: DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; scoped_ptr<LayerTreeHostImpl> m_hostImpl; + FakeRenderingStatsInstrumentation m_statsInstrumentation; bool m_onCanDrawStateChangedCalled; bool m_hasPendingTree; bool m_didRequestCommit; @@ -384,7 +386,7 @@ TEST_F(LayerTreeHostImplTest, scrollWithoutRootLayer) TEST_F(LayerTreeHostImplTest, scrollWithoutRenderer) { LayerTreeSettings settings; - m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy); + m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy, &m_statsInstrumentation); // Initialization will fail here. m_hostImpl->InitializeRenderer(FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>(new TestWebGraphicsContext3DMakeCurrentFails)).PassAs<OutputSurface>()); @@ -1102,7 +1104,7 @@ TEST_F(LayerTreeHostImplTest, scrollNonScrollableRootWithTopControls) settings.calculate_top_controls_position = true; settings.top_controls_height = 50; - m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy); + m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy, &m_statsInstrumentation); m_hostImpl->InitializeRenderer(createOutputSurface()); m_hostImpl->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); @@ -2152,7 +2154,7 @@ TEST_F(LayerTreeHostImplTest, partialSwapReceivesDamageRect) // that we can force partial swap enabled. LayerTreeSettings settings; settings.partial_swap_enabled = true; - scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy); + scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy, &m_statsInstrumentation); layerTreeHostImpl->InitializeRenderer(outputSurface.Pass()); layerTreeHostImpl->SetViewportSize(gfx::Size(500, 500), gfx::Size(500, 500)); @@ -2444,13 +2446,13 @@ public: } }; -static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, LayerTreeHostImplClient* client, Proxy* proxy) +static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, LayerTreeHostImplClient* client, Proxy* proxy, RenderingStatsInstrumentation* statsInstrumentation) { scoped_ptr<OutputSurface> outputSurface = FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>(); LayerTreeSettings settings; settings.partial_swap_enabled = partialSwap; - scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, client, proxy); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, client, proxy, statsInstrumentation); myHostImpl->InitializeRenderer(outputSurface.Pass()); myHostImpl->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); @@ -2514,7 +2516,7 @@ static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay TEST_F(LayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap) { - scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(true, this, &m_proxy); + scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(true, this, &m_proxy, &m_statsInstrumentation); { LayerTreeHostImpl::FrameData frame; @@ -2534,7 +2536,7 @@ TEST_F(LayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap) TEST_F(LayerTreeHostImplTest, contributingLayerEmptyScissorNoPartialSwap) { - scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(false, this, &m_proxy); + scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(false, this, &m_proxy, &m_statsInstrumentation); { LayerTreeHostImpl::FrameData frame; @@ -2749,7 +2751,7 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusion) LayerTreeSettings settings; settings.minimum_occlusion_tracking_size = gfx::Size(); settings.cache_render_pass_contents = true; - scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy, &m_statsInstrumentation); // Layers are structure as follows: // @@ -2864,7 +2866,7 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) LayerTreeSettings settings; settings.minimum_occlusion_tracking_size = gfx::Size(); settings.cache_render_pass_contents = true; - scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy, &m_statsInstrumentation); // Layers are structure as follows: // @@ -2979,7 +2981,7 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) LayerTreeSettings settings; settings.minimum_occlusion_tracking_size = gfx::Size(); settings.cache_render_pass_contents = true; - scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy, &m_statsInstrumentation); // Layers are structured as follows: // @@ -3066,7 +3068,7 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) { LayerTreeSettings settings; settings.cache_render_pass_contents = true; - scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy, &m_statsInstrumentation); // Layers are structured as follows: // @@ -3141,7 +3143,7 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) settings.minimum_occlusion_tracking_size = gfx::Size(); settings.partial_swap_enabled = true; settings.cache_render_pass_contents = true; - scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy, &m_statsInstrumentation); // Layers are structure as follows: // @@ -3253,7 +3255,7 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithScissor) LayerTreeSettings settings; settings.minimum_occlusion_tracking_size = gfx::Size(); settings.cache_render_pass_contents = true; - scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy, &m_statsInstrumentation); /* Layers are created as follows: @@ -3360,7 +3362,7 @@ TEST_F(LayerTreeHostImplTest, surfaceTextureCaching) settings.minimum_occlusion_tracking_size = gfx::Size(); settings.partial_swap_enabled = true; settings.cache_render_pass_contents = true; - scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy, &m_statsInstrumentation); LayerImpl* rootPtr; LayerImpl* intermediateLayerPtr; @@ -3519,7 +3521,7 @@ TEST_F(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) LayerTreeSettings settings; settings.minimum_occlusion_tracking_size = gfx::Size(); settings.cache_render_pass_contents = true; - scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy); + scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy, &m_statsInstrumentation); LayerImpl* rootPtr; LayerImpl* intermediateLayerPtr; diff --git a/cc/trees/proxy.h b/cc/trees/proxy.h index 703c07a..f0fece4 100644 --- a/cc/trees/proxy.h +++ b/cc/trees/proxy.h @@ -22,7 +22,6 @@ class Vector2d; namespace cc { class Thread; -struct RenderingStats; struct RendererCapabilities; // Abstract class responsible for proxying commands from the main-thread side of @@ -78,8 +77,6 @@ class CC_EXPORT Proxy { // Returns false if the renderer couldn't be reinitialized. virtual bool RecreateOutputSurface() = 0; - virtual void CollectRenderingStats(RenderingStats* stats) = 0; - virtual const RendererCapabilities& GetRendererCapabilities() const = 0; virtual void SetNeedsAnimate() = 0; diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc index 71c4652..da2046a 100644 --- a/cc/trees/single_thread_proxy.cc +++ b/cc/trees/single_thread_proxy.cc @@ -171,12 +171,6 @@ bool SingleThreadProxy::RecreateOutputSurface() { return initialized; } -void SingleThreadProxy::CollectRenderingStats(RenderingStats* stats) { - stats->totalCommitTime = total_commit_time_; - stats->totalCommitCount = total_commit_count_; - layer_tree_host_impl_->CollectRenderingStats(stats); -} - const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const { DCHECK(renderer_initialized_); // Note: this gets called during the commit by the "impl" thread. @@ -195,7 +189,10 @@ void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) { DebugScopedSetMainThreadBlocked mainThreadBlocked(this); DebugScopedSetImplThread impl(this); - base::TimeTicks startTime = base::TimeTicks::HighResNow(); + RenderingStatsInstrumentation* stats_instrumentation = + layer_tree_host_->rendering_stats_instrumentation(); + base::TimeTicks startTime = stats_instrumentation->StartRecording(); + layer_tree_host_impl_->BeginCommit(); layer_tree_host_->contents_texture_manager()-> @@ -222,9 +219,8 @@ void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) { DCHECK(!scrollInfo->scrolls.size()); #endif - base::TimeTicks endTime = base::TimeTicks::HighResNow(); - total_commit_time_ += endTime - startTime; - total_commit_count_++; + base::TimeDelta duration = stats_instrumentation->EndRecording(startTime); + stats_instrumentation->AddCommit(duration); } layer_tree_host_->CommitComplete(); next_frame_is_newly_committed_frame_ = true; diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h index f5917b2..ea6b549 100644 --- a/cc/trees/single_thread_proxy.h +++ b/cc/trees/single_thread_proxy.h @@ -35,7 +35,6 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { virtual void SetVisible(bool visible) OVERRIDE; virtual bool InitializeRenderer() OVERRIDE; virtual bool RecreateOutputSurface() OVERRIDE; - virtual void CollectRenderingStats(RenderingStats* stats) OVERRIDE; virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE; virtual void SetNeedsAnimate() OVERRIDE; virtual void SetNeedsCommit() OVERRIDE; diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc index 45835e8..ba621e2 100644 --- a/cc/trees/thread_proxy.cc +++ b/cc/trees/thread_proxy.cc @@ -60,7 +60,6 @@ ThreadProxy::ThreadProxy(LayerTreeHost* layer_tree_host, next_frame_is_newly_committed_frame_on_impl_thread_(false), render_vsync_enabled_(layer_tree_host->settings().render_vsync_enabled), inside_draw_(false), - total_commit_count_(0), defer_commits_(false), renew_tree_priority_on_impl_thread_pending_(false) { TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy"); @@ -278,22 +277,6 @@ bool ThreadProxy::RecreateOutputSurface() { return recreate_succeeded; } -void ThreadProxy::CollectRenderingStats(RenderingStats* stats) { - DCHECK(IsMainThread()); - - DebugScopedSetMainThreadBlocked main_thread_blocked(this); - CompletionEvent completion; - Proxy::ImplThread()->PostTask( - base::Bind(&ThreadProxy::RenderingStatsOnImplThread, - impl_thread_weak_ptr_, - &completion, - stats)); - stats->totalCommitTime = total_commit_time_; - stats->totalCommitCount = total_commit_count_; - - completion.Wait(); -} - const RendererCapabilities& ThreadProxy::GetRendererCapabilities() const { DCHECK(renderer_initialized_); return renderer_capabilities_main_thread_copy_; @@ -742,7 +725,10 @@ void ThreadProxy::BeginFrame( DebugScopedSetMainThreadBlocked main_thread_blocked(this); - base::TimeTicks start_time = base::TimeTicks::HighResNow(); + RenderingStatsInstrumentation* stats_instrumentation = + layer_tree_host_->rendering_stats_instrumentation(); + base::TimeTicks start_time = stats_instrumentation->StartRecording(); + CompletionEvent completion; Proxy::ImplThread()->PostTask( base::Bind(&ThreadProxy::BeginFrameCompleteOnImplThread, @@ -752,9 +738,8 @@ void ThreadProxy::BeginFrame( offscreen_context_provider)); completion.Wait(); - base::TimeTicks end_time = base::TimeTicks::HighResNow(); - total_commit_time_ += end_time - start_time; - total_commit_count_++; + base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); + stats_instrumentation->AddCommit(duration); } layer_tree_host_->CommitComplete(); @@ -1184,13 +1169,6 @@ void ThreadProxy::RecreateOutputSurfaceOnImplThread( completion->Signal(); } -void ThreadProxy::RenderingStatsOnImplThread(CompletionEvent* completion, - RenderingStats* stats) { - DCHECK(IsImplThread()); - layer_tree_host_impl_->CollectRenderingStats(stats); - completion->Signal(); -} - ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() : memory_allocation_limit_bytes(0) {} diff --git a/cc/trees/thread_proxy.h b/cc/trees/thread_proxy.h index d11b0a7..5a235e3 100644 --- a/cc/trees/thread_proxy.h +++ b/cc/trees/thread_proxy.h @@ -48,7 +48,6 @@ class ThreadProxy : public Proxy, virtual void SetVisible(bool visible) OVERRIDE; virtual bool InitializeRenderer() OVERRIDE; virtual bool RecreateOutputSurface() OVERRIDE; - virtual void CollectRenderingStats(RenderingStats* stats) OVERRIDE; virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE; virtual void SetNeedsAnimate() OVERRIDE; virtual void SetNeedsCommit() OVERRIDE; @@ -174,8 +173,6 @@ class ThreadProxy : public Proxy, scoped_refptr<cc::ContextProvider> offscreen_context_provider, bool* recreate_succeeded, RendererCapabilities* capabilities); - void RenderingStatsOnImplThread(CompletionEvent* completion, - RenderingStats* stats); ScheduledActionDrawAndSwapResult ScheduledActionDrawAndSwapInternal( bool forced_draw); void ForceSerializeOnSwapBuffersOnImplThread(CompletionEvent* completion); @@ -254,9 +251,6 @@ class ThreadProxy : public Proxy, bool inside_draw_; - base::TimeDelta total_commit_time_; - size_t total_commit_count_; - bool defer_commits_; scoped_ptr<BeginFrameAndCommitState> pending_deferred_commit_; diff --git a/cc/trees/tree_synchronizer_unittest.cc b/cc/trees/tree_synchronizer_unittest.cc index 3b1632c..ee66e956 100644 --- a/cc/trees/tree_synchronizer_unittest.cc +++ b/cc/trees/tree_synchronizer_unittest.cc @@ -484,8 +484,12 @@ TEST_F(TreeSynchronizerTest, SynchronizeAnimations) { LayerTreeSettings settings; FakeProxy proxy(scoped_ptr<Thread>(NULL)); DebugScopedSetImplThread impl(&proxy); + FakeRenderingStatsInstrumentation stats_instrumentation; scoped_ptr<LayerTreeHostImpl> host_impl = - LayerTreeHostImpl::Create(settings, NULL, &proxy); + LayerTreeHostImpl::Create(settings, + NULL, + &proxy, + &stats_instrumentation); scoped_refptr<Layer> layer_tree_root = Layer::Create(); diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index a8b70cd..680c85a 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h @@ -163,8 +163,6 @@ class CONTENT_EXPORT RenderWidget // Fills in a WebRenderingStatsImpl struct containing information about // rendering, e.g. count of frames rendered, time spent painting. - // This call is relatively expensive in threaded compositing mode, - // as it blocks on the compositor thread. void GetRenderingStats(WebKit::WebRenderingStatsImpl&) const; // Fills in a GpuRenderingStats struct containing information about |