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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 DebugScopedSetImplThread impl(this); | 75 DebugScopedSetImplThread impl(this); |
76 layer_tree_host_impl_->FinishAllRendering(); | 76 layer_tree_host_impl_->FinishAllRendering(); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 bool SingleThreadProxy::IsStarted() const { | 80 bool SingleThreadProxy::IsStarted() const { |
81 DCHECK(Proxy::IsMainThread()); | 81 DCHECK(Proxy::IsMainThread()); |
82 return layer_tree_host_impl_; | 82 return layer_tree_host_impl_; |
83 } | 83 } |
84 | 84 |
85 bool SingleThreadProxy::CommitToActiveTree() const { | |
86 // With SingleThreadProxy we skip the pending tree and commit directly to the | |
87 // active tree. | |
88 return false; | |
enne (OOO)
2015/01/28 01:14:53
...false?!
danakj
2015/01/28 01:28:20
Oh thats why my unittests started passing. thanks
| |
89 } | |
90 | |
85 void SingleThreadProxy::SetLayerTreeHostClientReady() { | 91 void SingleThreadProxy::SetLayerTreeHostClientReady() { |
86 TRACE_EVENT0("cc", "SingleThreadProxy::SetLayerTreeHostClientReady"); | 92 TRACE_EVENT0("cc", "SingleThreadProxy::SetLayerTreeHostClientReady"); |
87 // Scheduling is controlled by the embedder in the single thread case, so | 93 // Scheduling is controlled by the embedder in the single thread case, so |
88 // nothing to do. | 94 // nothing to do. |
89 DCHECK(Proxy::IsMainThread()); | 95 DCHECK(Proxy::IsMainThread()); |
90 DebugScopedSetImplThread impl(this); | 96 DebugScopedSetImplThread impl(this); |
91 if (layer_tree_host_->settings().single_thread_proxy_scheduler && | 97 if (layer_tree_host_->settings().single_thread_proxy_scheduler && |
92 !scheduler_on_impl_thread_) { | 98 !scheduler_on_impl_thread_) { |
93 SchedulerSettings scheduler_settings(layer_tree_host_->settings()); | 99 SchedulerSettings scheduler_settings(layer_tree_host_->settings()); |
94 scheduler_settings.main_thread_should_always_be_low_latency = true; | 100 scheduler_settings.main_thread_should_always_be_low_latency = true; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 // In the single-threaded case, the scale and scroll deltas should never be | 249 // In the single-threaded case, the scale and scroll deltas should never be |
244 // touched on the impl layer tree. | 250 // touched on the impl layer tree. |
245 scoped_ptr<ScrollAndScaleSet> scroll_info = | 251 scoped_ptr<ScrollAndScaleSet> scroll_info = |
246 layer_tree_host_impl_->ProcessScrollDeltas(); | 252 layer_tree_host_impl_->ProcessScrollDeltas(); |
247 DCHECK(!scroll_info->scrolls.size()); | 253 DCHECK(!scroll_info->scrolls.size()); |
248 DCHECK_EQ(1.f, scroll_info->page_scale_delta); | 254 DCHECK_EQ(1.f, scroll_info->page_scale_delta); |
249 #endif | 255 #endif |
250 } | 256 } |
251 | 257 |
252 if (layer_tree_host_->settings().impl_side_painting) { | 258 if (layer_tree_host_->settings().impl_side_painting) { |
253 // TODO(enne): just commit directly to the active tree. | 259 // Commit goes directly to the active tree, but we need to synchronously |
254 // | 260 // "activate" the tree still during commit to satisfy any potential |
255 // Synchronously activate during commit to satisfy any potential | |
256 // SetNextCommitWaitsForActivation calls. Unfortunately, the tree | 261 // SetNextCommitWaitsForActivation calls. Unfortunately, the tree |
257 // might not be ready to draw, so DidActivateSyncTree must set | 262 // might not be ready to draw, so DidActivateSyncTree must set |
258 // the flag to force the tree to not draw until textures are ready. | 263 // the flag to force the tree to not draw until textures are ready. |
259 NotifyReadyToActivate(); | 264 NotifyReadyToActivate(); |
260 } else { | 265 } else { |
261 CommitComplete(); | 266 CommitComplete(); |
262 } | 267 } |
263 } | 268 } |
264 | 269 |
265 void SingleThreadProxy::CommitComplete() { | 270 void SingleThreadProxy::CommitComplete() { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 return contents_texture_manager->ReduceMemoryOnImplThread( | 431 return contents_texture_manager->ReduceMemoryOnImplThread( |
427 limit_bytes, priority_cutoff, resource_provider); | 432 limit_bytes, priority_cutoff, resource_provider); |
428 } | 433 } |
429 | 434 |
430 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } | 435 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } |
431 | 436 |
432 void SingleThreadProxy::DidActivateSyncTree() { | 437 void SingleThreadProxy::DidActivateSyncTree() { |
433 // Non-impl-side painting finishes commit in DoCommit. Impl-side painting | 438 // Non-impl-side painting finishes commit in DoCommit. Impl-side painting |
434 // defers until here to simulate SetNextCommitWaitsForActivation. | 439 // defers until here to simulate SetNextCommitWaitsForActivation. |
435 if (layer_tree_host_impl_->settings().impl_side_painting) { | 440 if (layer_tree_host_impl_->settings().impl_side_painting) { |
436 // This is required because NotifyReadyToActivate gets called when | 441 // This is required because NotifyReadyToActivate gets called immediately |
437 // the pending tree is not actually ready in the SingleThreadProxy. | 442 // after commit since single thread commits directly to the active tree. |
438 layer_tree_host_impl_->SetRequiresHighResToDraw(); | 443 layer_tree_host_impl_->SetRequiresHighResToDraw(); |
439 | 444 |
440 CommitComplete(); | 445 CommitComplete(); |
441 } | 446 } |
442 | 447 |
443 timing_history_.DidActivateSyncTree(); | 448 timing_history_.DidActivateSyncTree(); |
444 } | 449 } |
445 | 450 |
446 void SingleThreadProxy::DidPrepareTiles() { | 451 void SingleThreadProxy::DidPrepareTiles() { |
447 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 452 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
814 | 819 |
815 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 820 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
816 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 821 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
817 } | 822 } |
818 | 823 |
819 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { | 824 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { |
820 layer_tree_host_->SendBeginFramesToChildren(args); | 825 layer_tree_host_->SendBeginFramesToChildren(args); |
821 } | 826 } |
822 | 827 |
823 } // namespace cc | 828 } // namespace cc |
OLD | NEW |