OLD | NEW |
---|---|
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/trees/thread_proxy.h" | 5 #include "cc/trees/thread_proxy.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 "ThreadProxy::DidSwapBuffersCompleteOnImplThread"); | 359 "ThreadProxy::DidSwapBuffersCompleteOnImplThread"); |
360 DCHECK(IsImplThread()); | 360 DCHECK(IsImplThread()); |
361 impl().scheduler->DidSwapBuffersComplete(); | 361 impl().scheduler->DidSwapBuffersComplete(); |
362 Proxy::MainThreadTaskRunner()->PostTask( | 362 Proxy::MainThreadTaskRunner()->PostTask( |
363 FROM_HERE, | 363 FROM_HERE, |
364 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); | 364 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); |
365 } | 365 } |
366 | 366 |
367 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { | 367 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { |
368 impl().layer_tree_host_impl->WillBeginImplFrame(args); | 368 impl().layer_tree_host_impl->WillBeginImplFrame(args); |
369 impl().last_begin_impl_frame_args = | |
370 impl().layer_tree_host_impl->CurrentBeginFrameArgs(); | |
369 } | 371 } |
370 | 372 |
371 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 373 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
372 TRACE_EVENT1( | 374 TRACE_EVENT1( |
373 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); | 375 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
374 DCHECK(IsImplThread()); | 376 DCHECK(IsImplThread()); |
375 impl().scheduler->SetCanDraw(can_draw); | 377 impl().scheduler->SetCanDraw(can_draw); |
376 } | 378 } |
377 | 379 |
378 void ThreadProxy::NotifyReadyToActivate() { | 380 void ThreadProxy::NotifyReadyToActivate() { |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
684 | 686 |
685 if (!impl().layer_tree_host_impl->settings().impl_side_painting) { | 687 if (!impl().layer_tree_host_impl->settings().impl_side_painting) { |
686 DCHECK_GT(impl().layer_tree_host_impl->memory_allocation_limit_bytes(), 0u); | 688 DCHECK_GT(impl().layer_tree_host_impl->memory_allocation_limit_bytes(), 0u); |
687 } | 689 } |
688 begin_main_frame_state->memory_allocation_limit_bytes = | 690 begin_main_frame_state->memory_allocation_limit_bytes = |
689 impl().layer_tree_host_impl->memory_allocation_limit_bytes(); | 691 impl().layer_tree_host_impl->memory_allocation_limit_bytes(); |
690 begin_main_frame_state->memory_allocation_priority_cutoff = | 692 begin_main_frame_state->memory_allocation_priority_cutoff = |
691 impl().layer_tree_host_impl->memory_allocation_priority_cutoff(); | 693 impl().layer_tree_host_impl->memory_allocation_priority_cutoff(); |
692 begin_main_frame_state->evicted_ui_resources = | 694 begin_main_frame_state->evicted_ui_resources = |
693 impl().layer_tree_host_impl->EvictedUIResourcesExist(); | 695 impl().layer_tree_host_impl->EvictedUIResourcesExist(); |
696 impl().last_begin_main_frame_args = begin_main_frame_state->begin_frame_args; | |
brianderson
2015/03/20 21:14:05
If main_frame_before_activation_enabled is true in
vmpstr
2015/03/20 22:31:27
What's the expected behavior (if say this is made
brianderson
2015/03/20 23:01:58
Yes, we would have overlapping frames and we would
vmpstr
2015/03/23 20:26:43
Done.
| |
694 Proxy::MainThreadTaskRunner()->PostTask( | 697 Proxy::MainThreadTaskRunner()->PostTask( |
695 FROM_HERE, | 698 FROM_HERE, |
696 base::Bind(&ThreadProxy::BeginMainFrame, | 699 base::Bind(&ThreadProxy::BeginMainFrame, |
697 main_thread_weak_ptr_, | 700 main_thread_weak_ptr_, |
698 base::Passed(&begin_main_frame_state))); | 701 base::Passed(&begin_main_frame_state))); |
699 devtools_instrumentation::DidRequestMainThreadFrame( | 702 devtools_instrumentation::DidRequestMainThreadFrame( |
700 impl().layer_tree_host_id); | 703 impl().layer_tree_host_id); |
701 impl().timing_history.DidBeginMainFrame(); | 704 impl().timing_history.DidBeginMainFrame(); |
702 } | 705 } |
703 | 706 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
928 | 931 |
929 void ThreadProxy::BeginMainFrameAbortedOnImplThread( | 932 void ThreadProxy::BeginMainFrameAbortedOnImplThread( |
930 CommitEarlyOutReason reason) { | 933 CommitEarlyOutReason reason) { |
931 TRACE_EVENT1("cc", "ThreadProxy::BeginMainFrameAbortedOnImplThread", "reason", | 934 TRACE_EVENT1("cc", "ThreadProxy::BeginMainFrameAbortedOnImplThread", "reason", |
932 CommitEarlyOutReasonToString(reason)); | 935 CommitEarlyOutReasonToString(reason)); |
933 DCHECK(IsImplThread()); | 936 DCHECK(IsImplThread()); |
934 DCHECK(impl().scheduler); | 937 DCHECK(impl().scheduler); |
935 DCHECK(impl().scheduler->CommitPending()); | 938 DCHECK(impl().scheduler->CommitPending()); |
936 DCHECK(!impl().layer_tree_host_impl->pending_tree()); | 939 DCHECK(!impl().layer_tree_host_impl->pending_tree()); |
937 | 940 |
938 if (CommitEarlyOutHandledCommit(reason)) | 941 if (CommitEarlyOutHandledCommit(reason)) { |
939 SetInputThrottledUntilCommitOnImplThread(false); | 942 SetInputThrottledUntilCommitOnImplThread(false); |
943 RecordMainFrameTiming(); | |
944 } | |
940 impl().layer_tree_host_impl->BeginMainFrameAborted(reason); | 945 impl().layer_tree_host_impl->BeginMainFrameAborted(reason); |
941 impl().scheduler->BeginMainFrameAborted(reason); | 946 impl().scheduler->BeginMainFrameAborted(reason); |
942 } | 947 } |
943 | 948 |
944 void ThreadProxy::ScheduledActionAnimate() { | 949 void ThreadProxy::ScheduledActionAnimate() { |
945 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionAnimate"); | 950 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionAnimate"); |
946 DCHECK(IsImplThread()); | 951 DCHECK(IsImplThread()); |
947 | 952 |
948 // Don't animate if there is no root layer. | 953 // Don't animate if there is no root layer. |
949 // TODO(mithro): Both Animate and UpdateAnimationState already have a | 954 // TODO(mithro): Both Animate and UpdateAnimationState already have a |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1349 | 1354 |
1350 if (impl().completion_event_for_commit_held_on_tree_activation) { | 1355 if (impl().completion_event_for_commit_held_on_tree_activation) { |
1351 TRACE_EVENT_INSTANT0( | 1356 TRACE_EVENT_INSTANT0( |
1352 "cc", "ReleaseCommitbyActivation", TRACE_EVENT_SCOPE_THREAD); | 1357 "cc", "ReleaseCommitbyActivation", TRACE_EVENT_SCOPE_THREAD); |
1353 DCHECK(impl().layer_tree_host_impl->settings().impl_side_painting); | 1358 DCHECK(impl().layer_tree_host_impl->settings().impl_side_painting); |
1354 impl().completion_event_for_commit_held_on_tree_activation->Signal(); | 1359 impl().completion_event_for_commit_held_on_tree_activation->Signal(); |
1355 impl().completion_event_for_commit_held_on_tree_activation = NULL; | 1360 impl().completion_event_for_commit_held_on_tree_activation = NULL; |
1356 } | 1361 } |
1357 | 1362 |
1358 impl().timing_history.DidActivateSyncTree(); | 1363 impl().timing_history.DidActivateSyncTree(); |
1364 RecordMainFrameTiming(); | |
brianderson
2015/03/20 21:14:06
Regarding the interval / prediction issue, we shou
vmpstr
2015/03/20 22:31:27
I think that's an excellent idea. I'm guessing the
brianderson
2015/03/20 23:01:58
There are no plans to get rid of it. It's especial
mithro-old
2015/03/23 00:15:08
I agree with Brian here.
vmpstr
2015/03/23 20:26:43
Done.
| |
1359 } | 1365 } |
1360 | 1366 |
1361 void ThreadProxy::DidPrepareTiles() { | 1367 void ThreadProxy::DidPrepareTiles() { |
1362 DCHECK(IsImplThread()); | 1368 DCHECK(IsImplThread()); |
1363 impl().scheduler->DidPrepareTiles(); | 1369 impl().scheduler->DidPrepareTiles(); |
1364 } | 1370 } |
1365 | 1371 |
1366 void ThreadProxy::DidCompletePageScaleAnimationOnImplThread() { | 1372 void ThreadProxy::DidCompletePageScaleAnimationOnImplThread() { |
1367 DCHECK(IsImplThread()); | 1373 DCHECK(IsImplThread()); |
1368 Proxy::MainThreadTaskRunner()->PostTask( | 1374 Proxy::MainThreadTaskRunner()->PostTask( |
1369 FROM_HERE, base::Bind(&ThreadProxy::DidCompletePageScaleAnimation, | 1375 FROM_HERE, base::Bind(&ThreadProxy::DidCompletePageScaleAnimation, |
1370 main_thread_weak_ptr_)); | 1376 main_thread_weak_ptr_)); |
1371 } | 1377 } |
1372 | 1378 |
1379 void ThreadProxy::RecordMainFrameTiming() { | |
1380 // Last begin main frame args records the frame args that we last sent to the | |
1381 // main thread. Last begin impl frame args, on the other hand, records the | |
1382 // last time we started an impl frame which should be the frame during which | |
1383 // this call is being run. | |
1384 impl().layer_tree_host_impl->RecordMainFrameTiming( | |
1385 impl().last_begin_main_frame_args, impl().last_begin_impl_frame_args); | |
brianderson
2015/03/20 21:14:06
Although this is slightly wrong right now because
vmpstr
2015/03/20 22:31:27
Acknowledged.
| |
1386 } | |
1387 | |
1373 } // namespace cc | 1388 } // namespace cc |
OLD | NEW |