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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 if (output_surface_creation_requested_) | 128 if (output_surface_creation_requested_) |
129 return; | 129 return; |
130 output_surface_creation_requested_ = true; | 130 output_surface_creation_requested_ = true; |
131 layer_tree_host_->RequestNewOutputSurface(); | 131 layer_tree_host_->RequestNewOutputSurface(); |
132 } | 132 } |
133 | 133 |
134 void SingleThreadProxy::SetOutputSurface( | 134 void SingleThreadProxy::SetOutputSurface( |
135 scoped_ptr<OutputSurface> output_surface) { | 135 scoped_ptr<OutputSurface> output_surface) { |
136 DCHECK(Proxy::IsMainThread()); | 136 DCHECK(Proxy::IsMainThread()); |
137 DCHECK(layer_tree_host_->output_surface_lost()); | 137 DCHECK(layer_tree_host_->output_surface_lost()); |
138 output_surface_creation_requested_ = false; | 138 DCHECK(output_surface_creation_requested_); |
139 renderer_capabilities_for_main_thread_ = RendererCapabilities(); | 139 renderer_capabilities_for_main_thread_ = RendererCapabilities(); |
140 | 140 |
141 bool success; | 141 bool success; |
142 { | 142 { |
143 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 143 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
144 DebugScopedSetImplThread impl(this); | 144 DebugScopedSetImplThread impl(this); |
145 layer_tree_host_->DeleteContentsTexturesOnImplThread( | 145 layer_tree_host_->DeleteContentsTexturesOnImplThread( |
146 layer_tree_host_impl_->resource_provider()); | 146 layer_tree_host_impl_->resource_provider()); |
147 success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); | 147 success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); |
148 } | 148 } |
149 | 149 |
150 if (success) { | 150 if (success) { |
151 layer_tree_host_->DidInitializeOutputSurface(); | 151 layer_tree_host_->DidInitializeOutputSurface(); |
152 if (scheduler_on_impl_thread_) | 152 if (scheduler_on_impl_thread_) |
153 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); | 153 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); |
154 else if (!inside_synchronous_composite_) | 154 else if (!inside_synchronous_composite_) |
155 SetNeedsCommit(); | 155 SetNeedsCommit(); |
| 156 output_surface_creation_requested_ = false; |
156 } else { | 157 } else { |
| 158 // DidFailToInitializeOutputSurface is treated as a RequestNewOutputSurface, |
| 159 // and so output_surface_creation_requested remains true. |
157 layer_tree_host_->DidFailToInitializeOutputSurface(); | 160 layer_tree_host_->DidFailToInitializeOutputSurface(); |
158 } | 161 } |
159 } | 162 } |
160 | 163 |
161 const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const { | 164 const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const { |
162 DCHECK(Proxy::IsMainThread()); | 165 DCHECK(Proxy::IsMainThread()); |
163 DCHECK(!layer_tree_host_->output_surface_lost()); | 166 DCHECK(!layer_tree_host_->output_surface_lost()); |
164 return renderer_capabilities_for_main_thread_; | 167 return renderer_capabilities_for_main_thread_; |
165 } | 168 } |
166 | 169 |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 | 814 |
812 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 815 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
813 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 816 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
814 } | 817 } |
815 | 818 |
816 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { | 819 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { |
817 layer_tree_host_->SendBeginFramesToChildren(args); | 820 layer_tree_host_->SendBeginFramesToChildren(args); |
818 } | 821 } |
819 | 822 |
820 } // namespace cc | 823 } // namespace cc |
OLD | NEW |