diff options
author | skyostil <skyostil@chromium.org> | 2015-08-19 05:02:24 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-19 12:03:06 +0000 |
commit | 6d20710c80b4f5d7fd0c0ed2dafbc88bfc93bc91 (patch) | |
tree | 307959ac418a2736e3678e16c046cbc9c1614fb5 /cc | |
parent | a0d9556693c271f91305b4969d4cb094487b09bd (diff) | |
download | chromium_src-6d20710c80b4f5d7fd0c0ed2dafbc88bfc93bc91.zip chromium_src-6d20710c80b4f5d7fd0c0ed2dafbc88bfc93bc91.tar.gz chromium_src-6d20710c80b4f5d7fd0c0ed2dafbc88bfc93bc91.tar.bz2 |
cc: Emit fewer trace events for SetNeeds{Animate,UpdateLayers,Commit}
Only emit a trace event for SetNeeds{Animate,UpdateLayers,Commit} if we
actually sent a request to the impl thread. This cuts down a potentially
large number of trace events coming from these functions.
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1290303004
Cr-Commit-Position: refs/heads/master@{#344206}
Diffstat (limited to 'cc')
-rw-r--r-- | cc/trees/thread_proxy.cc | 23 | ||||
-rw-r--r-- | cc/trees/thread_proxy.h | 4 |
2 files changed, 18 insertions, 9 deletions
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc index ba1f946..e530931 100644 --- a/cc/trees/thread_proxy.cc +++ b/cc/trees/thread_proxy.cc @@ -236,7 +236,7 @@ void ThreadProxy::SetRendererCapabilitiesMainThreadCopy( main().renderer_capabilities_main_thread_copy = capabilities; } -void ThreadProxy::SendCommitRequestToImplThreadIfNeeded( +bool ThreadProxy::SendCommitRequestToImplThreadIfNeeded( CommitPipelineStage required_stage) { DCHECK(IsMainThread()); DCHECK_NE(NO_PIPELINE_STAGE, required_stage); @@ -245,11 +245,12 @@ void ThreadProxy::SendCommitRequestToImplThreadIfNeeded( main().max_requested_pipeline_stage = std::max(main().max_requested_pipeline_stage, required_stage); if (already_posted) - return; + return false; Proxy::ImplThreadTaskRunner()->PostTask( FROM_HERE, base::Bind(&ThreadProxy::SetNeedsCommitOnImplThread, impl_thread_weak_ptr_)); + return true; } void ThreadProxy::DidCompletePageScaleAnimation() { @@ -265,20 +266,24 @@ const RendererCapabilities& ThreadProxy::GetRendererCapabilities() const { void ThreadProxy::SetNeedsAnimate() { DCHECK(IsMainThread()); - TRACE_EVENT0("cc", "ThreadProxy::SetNeedsAnimate"); - SendCommitRequestToImplThreadIfNeeded(ANIMATE_PIPELINE_STAGE); + if (SendCommitRequestToImplThreadIfNeeded(ANIMATE_PIPELINE_STAGE)) { + TRACE_EVENT_INSTANT0("cc", "ThreadProxy::SetNeedsAnimate", + TRACE_EVENT_SCOPE_THREAD); + } } void ThreadProxy::SetNeedsUpdateLayers() { DCHECK(IsMainThread()); - TRACE_EVENT0("cc", "ThreadProxy::SetNeedsUpdateLayers"); // If we are currently animating, make sure we also update the layers. if (main().current_pipeline_stage == ANIMATE_PIPELINE_STAGE) { main().final_pipeline_stage = std::max(main().final_pipeline_stage, UPDATE_LAYERS_PIPELINE_STAGE); return; } - SendCommitRequestToImplThreadIfNeeded(UPDATE_LAYERS_PIPELINE_STAGE); + if (SendCommitRequestToImplThreadIfNeeded(UPDATE_LAYERS_PIPELINE_STAGE)) { + TRACE_EVENT_INSTANT0("cc", "ThreadProxy::SetNeedsUpdateLayers", + TRACE_EVENT_SCOPE_THREAD); + } } void ThreadProxy::SetNeedsCommit() { @@ -291,8 +296,10 @@ void ThreadProxy::SetNeedsCommit() { std::max(main().final_pipeline_stage, COMMIT_PIPELINE_STAGE); return; } - TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommit"); - SendCommitRequestToImplThreadIfNeeded(COMMIT_PIPELINE_STAGE); + if (SendCommitRequestToImplThreadIfNeeded(COMMIT_PIPELINE_STAGE)) { + TRACE_EVENT_INSTANT0("cc", "ThreadProxy::SetNeedsCommit", + TRACE_EVENT_SCOPE_THREAD); + } } void ThreadProxy::UpdateRendererCapabilitiesOnImplThread() { diff --git a/cc/trees/thread_proxy.h b/cc/trees/thread_proxy.h index a2e7bec..ae9c733 100644 --- a/cc/trees/thread_proxy.h +++ b/cc/trees/thread_proxy.h @@ -255,7 +255,9 @@ class CC_EXPORT ThreadProxy : public Proxy, void RequestNewOutputSurface(); void DidInitializeOutputSurface(bool success, const RendererCapabilities& capabilities); - void SendCommitRequestToImplThreadIfNeeded( + // Returns |true| if the request was actually sent, |false| if one was + // already outstanding. + bool SendCommitRequestToImplThreadIfNeeded( CommitPipelineStage required_stage); void DidCompletePageScaleAnimation(); |