| 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 26 matching lines...) Expand all Loading... |
| 37 inside_draw_(false) { | 37 inside_draw_(false) { |
| 38 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); | 38 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); |
| 39 DCHECK(Proxy::IsMainThread()); | 39 DCHECK(Proxy::IsMainThread()); |
| 40 DCHECK(layer_tree_host); | 40 DCHECK(layer_tree_host); |
| 41 | 41 |
| 42 // Impl-side painting not supported without threaded compositing. | 42 // Impl-side painting not supported without threaded compositing. |
| 43 CHECK(!layer_tree_host->settings().impl_side_painting) | 43 CHECK(!layer_tree_host->settings().impl_side_painting) |
| 44 << "Threaded compositing must be enabled to use impl-side painting."; | 44 << "Threaded compositing must be enabled to use impl-side painting."; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void SingleThreadProxy::Start(scoped_ptr<OutputSurface> first_output_surface) { | 47 void SingleThreadProxy::Start() { |
| 48 DCHECK(first_output_surface); | |
| 49 DebugScopedSetImplThread impl(this); | 48 DebugScopedSetImplThread impl(this); |
| 50 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); | 49 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); |
| 51 first_output_surface_ = first_output_surface.Pass(); | |
| 52 } | 50 } |
| 53 | 51 |
| 54 SingleThreadProxy::~SingleThreadProxy() { | 52 SingleThreadProxy::~SingleThreadProxy() { |
| 55 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); | 53 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); |
| 56 DCHECK(Proxy::IsMainThread()); | 54 DCHECK(Proxy::IsMainThread()); |
| 57 // Make sure Stop() got called or never Started. | 55 // Make sure Stop() got called or never Started. |
| 58 DCHECK(!layer_tree_host_impl_); | 56 DCHECK(!layer_tree_host_impl_); |
| 59 } | 57 } |
| 60 | 58 |
| 61 bool SingleThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) { | 59 bool SingleThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 88 DebugScopedSetImplThread impl(this); | 86 DebugScopedSetImplThread impl(this); |
| 89 layer_tree_host_impl_->FinishAllRendering(); | 87 layer_tree_host_impl_->FinishAllRendering(); |
| 90 } | 88 } |
| 91 } | 89 } |
| 92 | 90 |
| 93 bool SingleThreadProxy::IsStarted() const { | 91 bool SingleThreadProxy::IsStarted() const { |
| 94 DCHECK(Proxy::IsMainThread()); | 92 DCHECK(Proxy::IsMainThread()); |
| 95 return layer_tree_host_impl_; | 93 return layer_tree_host_impl_; |
| 96 } | 94 } |
| 97 | 95 |
| 98 void SingleThreadProxy::SetLayerTreeHostClientReady() { | 96 void SingleThreadProxy::SetLayerTreeHostClientReady( |
| 99 // Scheduling is controlled by the embedder in the single thread case, so | 97 scoped_ptr<OutputSurface> first_output_surface) { |
| 100 // nothing to do. | 98 DCHECK(first_output_surface); |
| 99 first_output_surface_ = first_output_surface.Pass(); |
| 101 } | 100 } |
| 102 | 101 |
| 103 void SingleThreadProxy::SetVisible(bool visible) { | 102 void SingleThreadProxy::SetVisible(bool visible) { |
| 104 DebugScopedSetImplThread impl(this); | 103 DebugScopedSetImplThread impl(this); |
| 105 layer_tree_host_impl_->SetVisible(visible); | 104 layer_tree_host_impl_->SetVisible(visible); |
| 106 | 105 |
| 107 // Changing visibility could change ShouldComposite(). | 106 // Changing visibility could change ShouldComposite(). |
| 108 UpdateBackgroundAnimateTicking(); | 107 UpdateBackgroundAnimateTicking(); |
| 109 } | 108 } |
| 110 | 109 |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 void SingleThreadProxy::DidSwapFrame() { | 541 void SingleThreadProxy::DidSwapFrame() { |
| 543 if (next_frame_is_newly_committed_frame_) { | 542 if (next_frame_is_newly_committed_frame_) { |
| 544 next_frame_is_newly_committed_frame_ = false; | 543 next_frame_is_newly_committed_frame_ = false; |
| 545 layer_tree_host_->DidCommitAndDrawFrame(); | 544 layer_tree_host_->DidCommitAndDrawFrame(); |
| 546 } | 545 } |
| 547 } | 546 } |
| 548 | 547 |
| 549 bool SingleThreadProxy::CommitPendingForTesting() { return false; } | 548 bool SingleThreadProxy::CommitPendingForTesting() { return false; } |
| 550 | 549 |
| 551 } // namespace cc | 550 } // namespace cc |
| OLD | NEW |