diff options
Diffstat (limited to 'cc/trees/thread_proxy.cc')
-rw-r--r-- | cc/trees/thread_proxy.cc | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc index e66dab3..0974592 100644 --- a/cc/trees/thread_proxy.cc +++ b/cc/trees/thread_proxy.cc @@ -60,6 +60,7 @@ ThreadProxy::ThreadProxy(LayerTreeHost* layer_tree_host, next_frame_is_newly_committed_frame_on_impl_thread_(false), render_vsync_enabled_(layer_tree_host->settings().renderVSyncEnabled), inside_draw_(false), + total_commit_count_(0), defer_commits_(false), renew_tree_priority_on_impl_thread_pending_(false) { TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy"); @@ -277,6 +278,22 @@ 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_; @@ -725,10 +742,7 @@ void ThreadProxy::BeginFrame( DebugScopedSetMainThreadBlocked main_thread_blocked(this); - RenderingStatsInstrumentation* stats_instrumentation = - layer_tree_host_->rendering_stats_instrumentation(); - base::TimeTicks start_time = stats_instrumentation->StartRecording(); - + base::TimeTicks start_time = base::TimeTicks::HighResNow(); CompletionEvent completion; Proxy::ImplThread()->PostTask( base::Bind(&ThreadProxy::BeginFrameCompleteOnImplThread, @@ -738,8 +752,9 @@ void ThreadProxy::BeginFrame( offscreen_context_provider)); completion.Wait(); - base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); - stats_instrumentation->AddCommit(duration); + base::TimeTicks end_time = base::TimeTicks::HighResNow(); + total_commit_time_ += end_time - start_time; + total_commit_count_++; } layer_tree_host_->CommitComplete(); @@ -1169,6 +1184,13 @@ 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) {} |