| 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/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "cc/debug/benchmark_instrumentation.h" | 10 #include "cc/debug/benchmark_instrumentation.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 DebugScopedSetImplThread impl(this); | 116 DebugScopedSetImplThread impl(this); |
| 117 if (scheduler_on_impl_thread_) { | 117 if (scheduler_on_impl_thread_) { |
| 118 scheduler_on_impl_thread_->SetCanStart(); | 118 scheduler_on_impl_thread_->SetCanStart(); |
| 119 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); | 119 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 void SingleThreadProxy::SetVisible(bool visible) { | 123 void SingleThreadProxy::SetVisible(bool visible) { |
| 124 TRACE_EVENT1("cc", "SingleThreadProxy::SetVisible", "visible", visible); | 124 TRACE_EVENT1("cc", "SingleThreadProxy::SetVisible", "visible", visible); |
| 125 DebugScopedSetImplThread impl(this); | 125 DebugScopedSetImplThread impl(this); |
| 126 |
| 126 layer_tree_host_impl_->SetVisible(visible); | 127 layer_tree_host_impl_->SetVisible(visible); |
| 128 |
| 127 if (scheduler_on_impl_thread_) | 129 if (scheduler_on_impl_thread_) |
| 128 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); | 130 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); |
| 129 // Changing visibility could change ShouldComposite(). | 131 // Changing visibility could change ShouldComposite(). |
| 130 } | 132 } |
| 131 | 133 |
| 132 void SingleThreadProxy::SetThrottleFrameProduction(bool throttle) { | 134 void SingleThreadProxy::SetThrottleFrameProduction(bool throttle) { |
| 133 TRACE_EVENT1("cc", "SingleThreadProxy::SetThrottleFrameProduction", | 135 TRACE_EVENT1("cc", "SingleThreadProxy::SetThrottleFrameProduction", |
| 134 "throttle", throttle); | 136 "throttle", throttle); |
| 135 DebugScopedSetImplThread impl(this); | 137 DebugScopedSetImplThread impl(this); |
| 136 if (scheduler_on_impl_thread_) | 138 if (scheduler_on_impl_thread_) |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 TRACE_EVENT0( | 443 TRACE_EVENT0( |
| 442 "cc", "SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread"); | 444 "cc", "SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread"); |
| 443 DCHECK(Proxy::IsImplThread()); | 445 DCHECK(Proxy::IsImplThread()); |
| 444 DebugScopedSetMainThread main(this); | 446 DebugScopedSetMainThread main(this); |
| 445 layer_tree_host_->SetAnimationEvents(events.Pass()); | 447 layer_tree_host_->SetAnimationEvents(events.Pass()); |
| 446 } | 448 } |
| 447 | 449 |
| 448 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } | 450 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } |
| 449 | 451 |
| 450 void SingleThreadProxy::DidActivateSyncTree() { | 452 void SingleThreadProxy::DidActivateSyncTree() { |
| 451 // This is required because NotifyReadyToActivate gets called immediately | |
| 452 // after commit since single thread commits directly to the active tree. | |
| 453 if (scheduler_on_impl_thread_) | |
| 454 scheduler_on_impl_thread_->SetWaitForReadyToDraw(); | |
| 455 | |
| 456 // Synchronously call to CommitComplete. Resetting | 453 // Synchronously call to CommitComplete. Resetting |
| 457 // |commit_blocking_task_runner| would make sure all tasks posted during | 454 // |commit_blocking_task_runner| would make sure all tasks posted during |
| 458 // commit/activation before CommitComplete. | 455 // commit/activation before CommitComplete. |
| 459 CommitComplete(); | 456 CommitComplete(); |
| 460 } | 457 } |
| 461 | 458 |
| 462 void SingleThreadProxy::WillPrepareTiles() { | 459 void SingleThreadProxy::WillPrepareTiles() { |
| 463 DCHECK(Proxy::IsImplThread()); | 460 DCHECK(Proxy::IsImplThread()); |
| 464 if (scheduler_on_impl_thread_) | 461 if (scheduler_on_impl_thread_) |
| 465 scheduler_on_impl_thread_->WillPrepareTiles(); | 462 scheduler_on_impl_thread_->WillPrepareTiles(); |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 << "DidFinishImplFrame called while not inside an impl frame!"; | 920 << "DidFinishImplFrame called while not inside an impl frame!"; |
| 924 inside_impl_frame_ = false; | 921 inside_impl_frame_ = false; |
| 925 #endif | 922 #endif |
| 926 } | 923 } |
| 927 | 924 |
| 928 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { | 925 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { |
| 929 layer_tree_host_->SendBeginFramesToChildren(args); | 926 layer_tree_host_->SendBeginFramesToChildren(args); |
| 930 } | 927 } |
| 931 | 928 |
| 932 } // namespace cc | 929 } // namespace cc |
| OLD | NEW |