| 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/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "cc/debug/benchmark_instrumentation.h" | 9 #include "cc/debug/benchmark_instrumentation.h" |
| 10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 void SingleThreadProxy::SetLayerTreeHostClientReady() { | 84 void SingleThreadProxy::SetLayerTreeHostClientReady() { |
| 85 TRACE_EVENT0("cc", "SingleThreadProxy::SetLayerTreeHostClientReady"); | 85 TRACE_EVENT0("cc", "SingleThreadProxy::SetLayerTreeHostClientReady"); |
| 86 // Scheduling is controlled by the embedder in the single thread case, so | 86 // Scheduling is controlled by the embedder in the single thread case, so |
| 87 // nothing to do. | 87 // nothing to do. |
| 88 DCHECK(Proxy::IsMainThread()); | 88 DCHECK(Proxy::IsMainThread()); |
| 89 DebugScopedSetImplThread impl(this); | 89 DebugScopedSetImplThread impl(this); |
| 90 if (layer_tree_host_->settings().single_thread_proxy_scheduler && | 90 if (layer_tree_host_->settings().single_thread_proxy_scheduler && |
| 91 !scheduler_on_impl_thread_) { | 91 !scheduler_on_impl_thread_) { |
| 92 SchedulerSettings scheduler_settings(layer_tree_host_->settings()); | 92 SchedulerSettings scheduler_settings(layer_tree_host_->settings()); |
| 93 // SingleThreadProxy should run in main thread low latency mode. | |
| 94 scheduler_settings.main_thread_should_always_be_low_latency = true; | 93 scheduler_settings.main_thread_should_always_be_low_latency = true; |
| 95 scheduler_on_impl_thread_ = | 94 scheduler_on_impl_thread_ = |
| 96 Scheduler::Create(this, | 95 Scheduler::Create(this, |
| 97 scheduler_settings, | 96 scheduler_settings, |
| 98 layer_tree_host_->id(), | 97 layer_tree_host_->id(), |
| 99 MainThreadTaskRunner(), | 98 MainThreadTaskRunner(), |
| 100 base::PowerMonitor::Get(), | 99 base::PowerMonitor::Get(), |
| 101 external_begin_frame_source_.Pass()); | 100 external_begin_frame_source_.Pass()); |
| 102 scheduler_on_impl_thread_->SetCanStart(); | 101 scheduler_on_impl_thread_->SetCanStart(); |
| 103 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); | 102 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } | 419 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } |
| 421 | 420 |
| 422 void SingleThreadProxy::DidActivateSyncTree() { | 421 void SingleThreadProxy::DidActivateSyncTree() { |
| 423 // Non-impl-side painting finishes commit in DoCommit. Impl-side painting | 422 // Non-impl-side painting finishes commit in DoCommit. Impl-side painting |
| 424 // defers until here to simulate SetNextCommitWaitsForActivation. | 423 // defers until here to simulate SetNextCommitWaitsForActivation. |
| 425 if (layer_tree_host_impl_->settings().impl_side_painting) { | 424 if (layer_tree_host_impl_->settings().impl_side_painting) { |
| 426 // This is required because NotifyReadyToActivate gets called when | 425 // This is required because NotifyReadyToActivate gets called when |
| 427 // the pending tree is not actually ready in the SingleThreadProxy. | 426 // the pending tree is not actually ready in the SingleThreadProxy. |
| 428 layer_tree_host_impl_->SetRequiresHighResToDraw(); | 427 layer_tree_host_impl_->SetRequiresHighResToDraw(); |
| 429 | 428 |
| 430 // Synchronously call to CommitComplete. Resetting | 429 // Since activation could cause tasks to run, post CommitComplete |
| 431 // |commit_blocking_task_runner| would make sure all tasks posted during | 430 // separately so that it runs after these tasks. This is the loose |
| 432 // commit/activation before CommitComplete. | 431 // equivalent of blocking commit until activation and also running |
| 433 CommitComplete(); | 432 // all tasks posted during commit/activation before CommitComplete. |
| 433 MainThreadTaskRunner()->PostTask( |
| 434 FROM_HERE, base::Bind(&SingleThreadProxy::CommitComplete, |
| 435 weak_factory_.GetWeakPtr())); |
| 434 } | 436 } |
| 435 | 437 |
| 436 timing_history_.DidActivateSyncTree(); | 438 timing_history_.DidActivateSyncTree(); |
| 437 } | 439 } |
| 438 | 440 |
| 439 void SingleThreadProxy::DidManageTiles() { | 441 void SingleThreadProxy::DidManageTiles() { |
| 440 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 442 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
| 441 DCHECK(Proxy::IsImplThread()); | 443 DCHECK(Proxy::IsImplThread()); |
| 442 if (scheduler_on_impl_thread_) | 444 if (scheduler_on_impl_thread_) |
| 443 scheduler_on_impl_thread_->DidManageTiles(); | 445 scheduler_on_impl_thread_->DidManageTiles(); |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 | 795 |
| 794 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 796 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
| 795 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 797 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
| 796 } | 798 } |
| 797 | 799 |
| 798 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { | 800 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { |
| 799 layer_tree_host_->SendBeginFramesToChildren(args); | 801 layer_tree_host_->SendBeginFramesToChildren(args); |
| 800 } | 802 } |
| 801 | 803 |
| 802 } // namespace cc | 804 } // namespace cc |
| OLD | NEW |