Chromium Code Reviews| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 | 252 |
| 253 void ThreadProxy::SetRendererCapabilitiesMainThreadCopy( | 253 void ThreadProxy::SetRendererCapabilitiesMainThreadCopy( |
| 254 const RendererCapabilities& capabilities) { | 254 const RendererCapabilities& capabilities) { |
| 255 main().renderer_capabilities_main_thread_copy = capabilities; | 255 main().renderer_capabilities_main_thread_copy = capabilities; |
| 256 } | 256 } |
| 257 | 257 |
| 258 void ThreadProxy::SendCommitRequestToImplThreadIfNeeded() { | 258 void ThreadProxy::SendCommitRequestToImplThreadIfNeeded() { |
| 259 DCHECK(IsMainThread()); | 259 DCHECK(IsMainThread()); |
| 260 if (main().commit_request_sent_to_impl_thread) | 260 if (main().commit_request_sent_to_impl_thread) |
| 261 return; | 261 return; |
| 262 VLOG(2) << "ThreadProxy::SendCommitRequestToImplThreadIfNeeded"; | |
|
Ken Russell (switch to Gerrit)
2014/09/10 00:43:41
Would it be better to log earlier and include the
| |
| 262 main().commit_request_sent_to_impl_thread = true; | 263 main().commit_request_sent_to_impl_thread = true; |
| 263 Proxy::ImplThreadTaskRunner()->PostTask( | 264 Proxy::ImplThreadTaskRunner()->PostTask( |
| 264 FROM_HERE, | 265 FROM_HERE, |
| 265 base::Bind(&ThreadProxy::SetNeedsCommitOnImplThread, | 266 base::Bind(&ThreadProxy::SetNeedsCommitOnImplThread, |
| 266 impl_thread_weak_ptr_)); | 267 impl_thread_weak_ptr_)); |
| 267 } | 268 } |
| 268 | 269 |
| 269 const RendererCapabilities& ThreadProxy::GetRendererCapabilities() const { | 270 const RendererCapabilities& ThreadProxy::GetRendererCapabilities() const { |
| 270 DCHECK(IsMainThread()); | 271 DCHECK(IsMainThread()); |
| 271 DCHECK(!layer_tree_host()->output_surface_lost()); | 272 DCHECK(!layer_tree_host()->output_surface_lost()); |
| 272 return main().renderer_capabilities_main_thread_copy; | 273 return main().renderer_capabilities_main_thread_copy; |
| 273 } | 274 } |
| 274 | 275 |
| 275 void ThreadProxy::SetNeedsAnimate() { | 276 void ThreadProxy::SetNeedsAnimate() { |
| 276 DCHECK(IsMainThread()); | 277 DCHECK(IsMainThread()); |
| 277 if (main().animate_requested) | 278 if (main().animate_requested) |
| 278 return; | 279 return; |
| 279 | 280 |
| 280 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsAnimate"); | 281 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsAnimate"); |
| 282 VLOG(2) << "ThreadProxy::SetNeedsAnimate"; | |
|
Ken Russell (switch to Gerrit)
2014/09/10 00:43:41
Same question about logging earlier here.
| |
| 281 main().animate_requested = true; | 283 main().animate_requested = true; |
| 282 SendCommitRequestToImplThreadIfNeeded(); | 284 SendCommitRequestToImplThreadIfNeeded(); |
| 283 } | 285 } |
| 284 | 286 |
| 285 void ThreadProxy::SetNeedsUpdateLayers() { | 287 void ThreadProxy::SetNeedsUpdateLayers() { |
| 286 DCHECK(IsMainThread()); | 288 DCHECK(IsMainThread()); |
| 287 | 289 |
| 288 if (main().commit_request_sent_to_impl_thread) | 290 if (main().commit_request_sent_to_impl_thread) |
| 289 return; | 291 return; |
| 290 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsUpdateLayers"); | 292 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsUpdateLayers"); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 UpdateBackgroundAnimateTicking(); | 375 UpdateBackgroundAnimateTicking(); |
| 374 } | 376 } |
| 375 | 377 |
| 376 void ThreadProxy::NotifyReadyToActivate() { | 378 void ThreadProxy::NotifyReadyToActivate() { |
| 377 TRACE_EVENT0("cc", "ThreadProxy::NotifyReadyToActivate"); | 379 TRACE_EVENT0("cc", "ThreadProxy::NotifyReadyToActivate"); |
| 378 impl().scheduler->NotifyReadyToActivate(); | 380 impl().scheduler->NotifyReadyToActivate(); |
| 379 } | 381 } |
| 380 | 382 |
| 381 void ThreadProxy::SetNeedsCommitOnImplThread() { | 383 void ThreadProxy::SetNeedsCommitOnImplThread() { |
| 382 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommitOnImplThread"); | 384 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommitOnImplThread"); |
| 385 VLOG(2) << "ThreadProxy::SetNeedsCommitOnImplThread"; | |
| 383 DCHECK(IsImplThread()); | 386 DCHECK(IsImplThread()); |
| 384 impl().scheduler->SetNeedsCommit(); | 387 impl().scheduler->SetNeedsCommit(); |
| 385 } | 388 } |
| 386 | 389 |
| 387 void ThreadProxy::PostAnimationEventsToMainThreadOnImplThread( | 390 void ThreadProxy::PostAnimationEventsToMainThreadOnImplThread( |
| 388 scoped_ptr<AnimationEventsVector> events) { | 391 scoped_ptr<AnimationEventsVector> events) { |
| 389 TRACE_EVENT0("cc", | 392 TRACE_EVENT0("cc", |
| 390 "ThreadProxy::PostAnimationEventsToMainThreadOnImplThread"); | 393 "ThreadProxy::PostAnimationEventsToMainThreadOnImplThread"); |
| 391 DCHECK(IsImplThread()); | 394 DCHECK(IsImplThread()); |
| 392 Proxy::MainThreadTaskRunner()->PostTask( | 395 Proxy::MainThreadTaskRunner()->PostTask( |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 765 // Do not notify the impl thread of commit requests that occur during | 768 // Do not notify the impl thread of commit requests that occur during |
| 766 // the apply/animate/layout part of the BeginMainFrameAndCommit process since | 769 // the apply/animate/layout part of the BeginMainFrameAndCommit process since |
| 767 // those commit requests will get painted immediately. Once we have done | 770 // those commit requests will get painted immediately. Once we have done |
| 768 // the paint, main().commit_requested will be set to false to allow new commit | 771 // the paint, main().commit_requested will be set to false to allow new commit |
| 769 // requests to be scheduled. | 772 // requests to be scheduled. |
| 770 // On the other hand, the animate_requested flag should remain cleared | 773 // On the other hand, the animate_requested flag should remain cleared |
| 771 // here so that any animation requests generated by the apply or animate | 774 // here so that any animation requests generated by the apply or animate |
| 772 // callbacks will trigger another frame. | 775 // callbacks will trigger another frame. |
| 773 main().commit_requested = true; | 776 main().commit_requested = true; |
| 774 main().commit_request_sent_to_impl_thread = true; | 777 main().commit_request_sent_to_impl_thread = true; |
| 778 VLOG(2) << "ThreadProxy::BeginMainFrame: Commit requests silenced."; | |
| 775 | 779 |
| 776 layer_tree_host()->ApplyScrollAndScale( | 780 layer_tree_host()->ApplyScrollAndScale( |
| 777 begin_main_frame_state->scroll_info.get()); | 781 begin_main_frame_state->scroll_info.get()); |
| 778 | 782 |
| 779 layer_tree_host()->WillBeginMainFrame(); | 783 layer_tree_host()->WillBeginMainFrame(); |
| 780 | 784 |
| 781 layer_tree_host()->BeginMainFrame(begin_main_frame_state->begin_frame_args); | 785 layer_tree_host()->BeginMainFrame(begin_main_frame_state->begin_frame_args); |
| 782 layer_tree_host()->AnimateLayers( | 786 layer_tree_host()->AnimateLayers( |
| 783 begin_main_frame_state->begin_frame_args.frame_time); | 787 begin_main_frame_state->begin_frame_args.frame_time); |
| 784 blocked_main().last_monotonic_frame_begin_time = | 788 blocked_main().last_monotonic_frame_begin_time = |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 819 | 823 |
| 820 layer_tree_host()->WillCommit(); | 824 layer_tree_host()->WillCommit(); |
| 821 | 825 |
| 822 // Before calling animate, we set main().animate_requested to false. If it is | 826 // Before calling animate, we set main().animate_requested to false. If it is |
| 823 // true now, it means SetNeedAnimate was called again, but during a state when | 827 // true now, it means SetNeedAnimate was called again, but during a state when |
| 824 // main().commit_request_sent_to_impl_thread = true. We need to force that | 828 // main().commit_request_sent_to_impl_thread = true. We need to force that |
| 825 // call to happen again now so that the commit request is sent to the impl | 829 // call to happen again now so that the commit request is sent to the impl |
| 826 // thread. | 830 // thread. |
| 827 if (main().animate_requested) { | 831 if (main().animate_requested) { |
| 828 // Forces SetNeedsAnimate to consider posting a commit task. | 832 // Forces SetNeedsAnimate to consider posting a commit task. |
| 833 VLOG(2) << "ThreadProxy::BeginMainFrame: RAF requested."; | |
| 829 main().animate_requested = false; | 834 main().animate_requested = false; |
| 830 SetNeedsAnimate(); | 835 SetNeedsAnimate(); |
| 836 } else { | |
| 837 VLOG(2) << "ThreadProxy::BeginMainFrame: RAF NOT requested."; | |
| 831 } | 838 } |
| 832 | 839 |
| 833 if (!updated && can_cancel_this_commit) { | 840 if (!updated && can_cancel_this_commit) { |
| 834 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoUpdates", TRACE_EVENT_SCOPE_THREAD); | 841 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoUpdates", TRACE_EVENT_SCOPE_THREAD); |
| 835 VLOG(2) << "ThreadProxy::BeginMainFrame: EarlyOut_NoUpdates"; | 842 VLOG(2) << "ThreadProxy::BeginMainFrame: EarlyOut_NoUpdates"; |
| 836 bool did_handle = true; | 843 bool did_handle = true; |
| 837 Proxy::ImplThreadTaskRunner()->PostTask( | 844 Proxy::ImplThreadTaskRunner()->PostTask( |
| 838 FROM_HERE, | 845 FROM_HERE, |
| 839 base::Bind(&ThreadProxy::BeginMainFrameAbortedOnImplThread, | 846 base::Bind(&ThreadProxy::BeginMainFrameAbortedOnImplThread, |
| 840 impl_thread_weak_ptr_, | 847 impl_thread_weak_ptr_, |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1410 | 1417 |
| 1411 impl().timing_history.DidActivateSyncTree(); | 1418 impl().timing_history.DidActivateSyncTree(); |
| 1412 } | 1419 } |
| 1413 | 1420 |
| 1414 void ThreadProxy::DidManageTiles() { | 1421 void ThreadProxy::DidManageTiles() { |
| 1415 DCHECK(IsImplThread()); | 1422 DCHECK(IsImplThread()); |
| 1416 impl().scheduler->DidManageTiles(); | 1423 impl().scheduler->DidManageTiles(); |
| 1417 } | 1424 } |
| 1418 | 1425 |
| 1419 } // namespace cc | 1426 } // namespace cc |
| OLD | NEW |