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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 DCHECK(IsMainThread()); | 439 DCHECK(IsMainThread()); |
440 if (main().defer_commits == defer_commits) | 440 if (main().defer_commits == defer_commits) |
441 return; | 441 return; |
442 | 442 |
443 main().defer_commits = defer_commits; | 443 main().defer_commits = defer_commits; |
444 if (main().defer_commits) | 444 if (main().defer_commits) |
445 TRACE_EVENT_ASYNC_BEGIN0("cc", "ThreadProxy::SetDeferCommits", this); | 445 TRACE_EVENT_ASYNC_BEGIN0("cc", "ThreadProxy::SetDeferCommits", this); |
446 else | 446 else |
447 TRACE_EVENT_ASYNC_END0("cc", "ThreadProxy::SetDeferCommits", this); | 447 TRACE_EVENT_ASYNC_END0("cc", "ThreadProxy::SetDeferCommits", this); |
448 | 448 |
449 if (!main().defer_commits && main().pending_deferred_commit) { | 449 Proxy::ImplThreadTaskRunner()->PostTask( |
450 Proxy::MainThreadTaskRunner()->PostTask( | 450 FROM_HERE, |
451 FROM_HERE, | 451 base::Bind(&ThreadProxy::SetDeferCommitsOnImplThread, |
452 base::Bind(&ThreadProxy::BeginMainFrame, | 452 impl_thread_weak_ptr_, |
453 main_thread_weak_ptr_, | 453 defer_commits)); |
454 base::Passed(&main().pending_deferred_commit))); | 454 } |
455 } | 455 |
| 456 void ThreadProxy::SetDeferCommitsOnImplThread(bool defer_commits) const { |
| 457 DCHECK(IsImplThread()); |
| 458 impl().scheduler->SetDeferCommits(defer_commits); |
456 } | 459 } |
457 | 460 |
458 bool ThreadProxy::CommitRequested() const { | 461 bool ThreadProxy::CommitRequested() const { |
459 DCHECK(IsMainThread()); | 462 DCHECK(IsMainThread()); |
460 return main().commit_requested; | 463 return main().commit_requested; |
461 } | 464 } |
462 | 465 |
463 bool ThreadProxy::BeginMainFrameRequested() const { | 466 bool ThreadProxy::BeginMainFrameRequested() const { |
464 DCHECK(IsMainThread()); | 467 DCHECK(IsMainThread()); |
465 return main().commit_request_sent_to_impl_thread; | 468 return main().commit_request_sent_to_impl_thread; |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 | 691 |
689 void ThreadProxy::BeginMainFrame( | 692 void ThreadProxy::BeginMainFrame( |
690 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { | 693 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { |
691 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task( | 694 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task( |
692 benchmark_instrumentation::kDoBeginFrame, | 695 benchmark_instrumentation::kDoBeginFrame, |
693 begin_main_frame_state->begin_frame_id); | 696 begin_main_frame_state->begin_frame_id); |
694 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame"); | 697 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame"); |
695 DCHECK(IsMainThread()); | 698 DCHECK(IsMainThread()); |
696 | 699 |
697 if (main().defer_commits) { | 700 if (main().defer_commits) { |
698 main().pending_deferred_commit = begin_main_frame_state.Pass(); | 701 TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit", |
699 layer_tree_host()->DidDeferCommit(); | 702 TRACE_EVENT_SCOPE_THREAD); |
700 TRACE_EVENT_INSTANT0( | 703 Proxy::ImplThreadTaskRunner()->PostTask( |
701 "cc", "EarlyOut_DeferCommits", TRACE_EVENT_SCOPE_THREAD); | 704 FROM_HERE, base::Bind(&ThreadProxy::BeginMainFrameAbortedOnImplThread, |
| 705 impl_thread_weak_ptr_, |
| 706 CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT)); |
702 return; | 707 return; |
703 } | 708 } |
704 | 709 |
705 // If the commit finishes, LayerTreeHost will transfer its swap promises to | 710 // If the commit finishes, LayerTreeHost will transfer its swap promises to |
706 // LayerTreeImpl. The destructor of ScopedSwapPromiseChecker aborts the | 711 // LayerTreeImpl. The destructor of ScopedSwapPromiseChecker aborts the |
707 // remaining swap promises. | 712 // remaining swap promises. |
708 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host()); | 713 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host()); |
709 | 714 |
710 main().commit_requested = false; | 715 main().commit_requested = false; |
711 main().commit_request_sent_to_impl_thread = false; | 716 main().commit_request_sent_to_impl_thread = false; |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 | 1352 |
1348 impl().timing_history.DidActivateSyncTree(); | 1353 impl().timing_history.DidActivateSyncTree(); |
1349 } | 1354 } |
1350 | 1355 |
1351 void ThreadProxy::DidPrepareTiles() { | 1356 void ThreadProxy::DidPrepareTiles() { |
1352 DCHECK(IsImplThread()); | 1357 DCHECK(IsImplThread()); |
1353 impl().scheduler->DidPrepareTiles(); | 1358 impl().scheduler->DidPrepareTiles(); |
1354 } | 1359 } |
1355 | 1360 |
1356 } // namespace cc | 1361 } // namespace cc |
OLD | NEW |