Index: cc/trees/thread_proxy.cc |
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc |
index 86e834023b1a0398f5cd5a41c18001f66afcae23..b0070561e1ca43a9feaee3c352a0e8cabde747f4 100644 |
--- a/cc/trees/thread_proxy.cc |
+++ b/cc/trees/thread_proxy.cc |
@@ -623,6 +623,9 @@ void ThreadProxy::BeginMainFrame( |
benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task( |
benchmark_instrumentation::kDoBeginFrame, |
begin_main_frame_state->begin_frame_id); |
+ |
+ base::TimeTicks begin_main_frame_start_time = base::TimeTicks::Now(); |
+ |
TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame"); |
DCHECK(IsMainThread()); |
DCHECK_EQ(NO_PIPELINE_STAGE, main().current_pipeline_stage); |
@@ -631,7 +634,8 @@ void ThreadProxy::BeginMainFrame( |
TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit", |
TRACE_EVENT_SCOPE_THREAD); |
main().channel_main->BeginMainFrameAbortedOnImpl( |
- CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT); |
+ CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT, |
+ begin_main_frame_start_time); |
return; |
} |
@@ -646,7 +650,7 @@ void ThreadProxy::BeginMainFrame( |
if (!layer_tree_host()->visible()) { |
TRACE_EVENT_INSTANT0("cc", "EarlyOut_NotVisible", TRACE_EVENT_SCOPE_THREAD); |
main().channel_main->BeginMainFrameAbortedOnImpl( |
- CommitEarlyOutReason::ABORTED_NOT_VISIBLE); |
+ CommitEarlyOutReason::ABORTED_NOT_VISIBLE, begin_main_frame_start_time); |
return; |
} |
@@ -654,7 +658,8 @@ void ThreadProxy::BeginMainFrame( |
TRACE_EVENT_INSTANT0( |
"cc", "EarlyOut_OutputSurfaceLost", TRACE_EVENT_SCOPE_THREAD); |
main().channel_main->BeginMainFrameAbortedOnImpl( |
- CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST); |
+ CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST, |
+ begin_main_frame_start_time); |
return; |
} |
@@ -694,7 +699,7 @@ void ThreadProxy::BeginMainFrame( |
if (!updated && can_cancel_this_commit) { |
TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoUpdates", TRACE_EVENT_SCOPE_THREAD); |
main().channel_main->BeginMainFrameAbortedOnImpl( |
- CommitEarlyOutReason::FINISHED_NO_UPDATES); |
+ CommitEarlyOutReason::FINISHED_NO_UPDATES, begin_main_frame_start_time); |
// Although the commit is internally aborted, this is because it has been |
// detected to be a no-op. From the perspective of an embedder, this commit |
@@ -722,7 +727,8 @@ void ThreadProxy::BeginMainFrame( |
blocking_main_thread_task_runner()); |
CompletionEvent completion; |
- main().channel_main->StartCommitOnImpl(&completion); |
+ main().channel_main->StartCommitOnImpl(&completion, |
+ begin_main_frame_start_time); |
completion.Wait(); |
} |
@@ -737,7 +743,8 @@ void ThreadProxy::BeginMainFrameNotExpectedSoon() { |
layer_tree_host()->BeginMainFrameNotExpectedSoon(); |
} |
-void ThreadProxy::StartCommitOnImpl(CompletionEvent* completion) { |
+void ThreadProxy::StartCommitOnImpl(CompletionEvent* completion, |
+ base::TimeTicks main_thread_start_time) { |
TRACE_EVENT0("cc", "ThreadProxy::StartCommitOnImplThread"); |
DCHECK(!impl().commit_completion_event); |
DCHECK(IsImplThread() && IsMainThreadBlocked()); |
@@ -753,12 +760,14 @@ void ThreadProxy::StartCommitOnImpl(CompletionEvent* completion) { |
// Ideally, we should inform to impl thread when BeginMainFrame is started. |
// But, we can avoid a PostTask in here. |
- impl().scheduler->NotifyBeginMainFrameStarted(); |
+ impl().scheduler->NotifyBeginMainFrameStarted(main_thread_start_time); |
impl().commit_completion_event = completion; |
impl().scheduler->NotifyReadyToCommit(); |
} |
-void ThreadProxy::BeginMainFrameAbortedOnImpl(CommitEarlyOutReason reason) { |
+void ThreadProxy::BeginMainFrameAbortedOnImpl( |
+ CommitEarlyOutReason reason, |
+ base::TimeTicks main_thread_start_time) { |
TRACE_EVENT1("cc", "ThreadProxy::BeginMainFrameAbortedOnImplThread", "reason", |
CommitEarlyOutReasonToString(reason)); |
DCHECK(IsImplThread()); |
@@ -772,6 +781,7 @@ void ThreadProxy::BeginMainFrameAbortedOnImpl(CommitEarlyOutReason reason) { |
impl().last_begin_main_frame_args; |
} |
impl().layer_tree_host_impl->BeginMainFrameAborted(reason); |
+ impl().scheduler->NotifyBeginMainFrameStarted(main_thread_start_time); |
impl().scheduler->BeginMainFrameAborted(reason); |
} |