| 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/single_thread_proxy.h" | 5 #include "cc/trees/single_thread_proxy.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 } | 485 } |
| 486 | 486 |
| 487 // Run the "main thread" and get it to commit. | 487 // Run the "main thread" and get it to commit. |
| 488 { | 488 { |
| 489 #if DCHECK_IS_ON() | 489 #if DCHECK_IS_ON() |
| 490 DCHECK(inside_impl_frame_); | 490 DCHECK(inside_impl_frame_); |
| 491 #endif | 491 #endif |
| 492 DoBeginMainFrame(begin_frame_args); | 492 DoBeginMainFrame(begin_frame_args); |
| 493 DoCommit(); | 493 DoCommit(); |
| 494 | 494 |
| 495 DCHECK_EQ(0u, layer_tree_host_->num_queued_swap_promises()) | 495 DCHECK_EQ( |
| 496 0u, |
| 497 layer_tree_host_->GetSwapPromiseManager()->num_queued_swap_promises()) |
| 496 << "Commit should always succeed and transfer promises."; | 498 << "Commit should always succeed and transfer promises."; |
| 497 } | 499 } |
| 498 | 500 |
| 499 // Finish the impl frame. | 501 // Finish the impl frame. |
| 500 { | 502 { |
| 501 DebugScopedSetImplThread impl(task_runner_provider_); | 503 DebugScopedSetImplThread impl(task_runner_provider_); |
| 502 layer_tree_host_impl_->ActivateSyncTree(); | 504 layer_tree_host_impl_->ActivateSyncTree(); |
| 503 DCHECK( | 505 DCHECK( |
| 504 !layer_tree_host_impl_->active_tree()->needs_update_draw_properties()); | 506 !layer_tree_host_impl_->active_tree()->needs_update_draw_properties()); |
| 505 layer_tree_host_impl_->PrepareTiles(); | 507 layer_tree_host_impl_->PrepareTiles(); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 if (defer_commits_) { | 649 if (defer_commits_) { |
| 648 TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit", | 650 TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit", |
| 649 TRACE_EVENT_SCOPE_THREAD); | 651 TRACE_EVENT_SCOPE_THREAD); |
| 650 BeginMainFrameAbortedOnImplThread( | 652 BeginMainFrameAbortedOnImplThread( |
| 651 CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT); | 653 CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT); |
| 652 return; | 654 return; |
| 653 } | 655 } |
| 654 | 656 |
| 655 // This checker assumes NotifyReadyToCommit in this stack causes a synchronous | 657 // This checker assumes NotifyReadyToCommit in this stack causes a synchronous |
| 656 // commit. | 658 // commit. |
| 657 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host_); | 659 ScopedAbortRemainingSwapPromises swap_promise_checker( |
| 660 layer_tree_host_->GetSwapPromiseManager()); |
| 658 | 661 |
| 659 if (!layer_tree_host_->IsVisible()) { | 662 if (!layer_tree_host_->IsVisible()) { |
| 660 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NotVisible", TRACE_EVENT_SCOPE_THREAD); | 663 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NotVisible", TRACE_EVENT_SCOPE_THREAD); |
| 661 BeginMainFrameAbortedOnImplThread( | 664 BeginMainFrameAbortedOnImplThread( |
| 662 CommitEarlyOutReason::ABORTED_NOT_VISIBLE); | 665 CommitEarlyOutReason::ABORTED_NOT_VISIBLE); |
| 663 return; | 666 return; |
| 664 } | 667 } |
| 665 | 668 |
| 666 // Prevent new commits from being requested inside DoBeginMainFrame. | 669 // Prevent new commits from being requested inside DoBeginMainFrame. |
| 667 // Note: We do not want to prevent SetNeedsAnimate from requesting | 670 // Note: We do not want to prevent SetNeedsAnimate from requesting |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 void SingleThreadProxy::DidFinishImplFrame() { | 767 void SingleThreadProxy::DidFinishImplFrame() { |
| 765 layer_tree_host_impl_->DidFinishImplFrame(); | 768 layer_tree_host_impl_->DidFinishImplFrame(); |
| 766 #if DCHECK_IS_ON() | 769 #if DCHECK_IS_ON() |
| 767 DCHECK(inside_impl_frame_) | 770 DCHECK(inside_impl_frame_) |
| 768 << "DidFinishImplFrame called while not inside an impl frame!"; | 771 << "DidFinishImplFrame called while not inside an impl frame!"; |
| 769 inside_impl_frame_ = false; | 772 inside_impl_frame_ = false; |
| 770 #endif | 773 #endif |
| 771 } | 774 } |
| 772 | 775 |
| 773 } // namespace cc | 776 } // namespace cc |
| OLD | NEW |