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