| 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/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <stack> | 8 #include <stack> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // made a contract with our animation controllers that the registrar | 171 // made a contract with our animation controllers that the registrar |
| 172 // will outlive them, and we must make good. | 172 // will outlive them, and we must make good. |
| 173 root_layer_ = NULL; | 173 root_layer_ = NULL; |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 void LayerTreeHost::SetLayerTreeHostClientReady() { | 177 void LayerTreeHost::SetLayerTreeHostClientReady() { |
| 178 proxy_->SetLayerTreeHostClientReady(); | 178 proxy_->SetLayerTreeHostClientReady(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 static void LayerTreeHostOnOutputSurfaceCreatedCallback(Layer* layer) { | 181 static void LayerTreeHostRendererCapabilitiesChanged(Layer* layer) { |
| 182 // TODO(boliu): Rename this to Layer::RendererCapabilitiesChanged. |
| 182 layer->OnOutputSurfaceCreated(); | 183 layer->OnOutputSurfaceCreated(); |
| 183 } | 184 } |
| 184 | 185 |
| 186 void LayerTreeHost::RendererCapabilitiesChanged() { |
| 187 if (root_layer()) { |
| 188 LayerTreeHostCommon::CallFunctionForSubtree( |
| 189 root_layer(), |
| 190 base::Bind(&LayerTreeHostRendererCapabilitiesChanged)); |
| 191 } |
| 192 } |
| 193 |
| 185 LayerTreeHost::CreateResult | 194 LayerTreeHost::CreateResult |
| 186 LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(bool success) { | 195 LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(bool success) { |
| 187 TRACE_EVENT1("cc", | 196 TRACE_EVENT1("cc", |
| 188 "LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted", | 197 "LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted", |
| 189 "success", | 198 "success", |
| 190 success); | 199 success); |
| 191 | 200 |
| 192 DCHECK(output_surface_lost_); | 201 DCHECK(output_surface_lost_); |
| 193 if (success) { | 202 if (success) { |
| 194 output_surface_lost_ = false; | 203 output_surface_lost_ = false; |
| 195 | 204 |
| 196 if (!contents_texture_manager_ && !settings_.impl_side_painting) { | 205 if (!contents_texture_manager_ && !settings_.impl_side_painting) { |
| 197 contents_texture_manager_ = | 206 contents_texture_manager_ = |
| 198 PrioritizedResourceManager::Create(proxy_.get()); | 207 PrioritizedResourceManager::Create(proxy_.get()); |
| 199 surface_memory_placeholder_ = | 208 surface_memory_placeholder_ = |
| 200 contents_texture_manager_->CreateTexture(gfx::Size(), RGBA_8888); | 209 contents_texture_manager_->CreateTexture(gfx::Size(), RGBA_8888); |
| 201 } | 210 } |
| 202 | 211 |
| 203 if (root_layer()) { | |
| 204 LayerTreeHostCommon::CallFunctionForSubtree( | |
| 205 root_layer(), | |
| 206 base::Bind(&LayerTreeHostOnOutputSurfaceCreatedCallback)); | |
| 207 } | |
| 208 | |
| 209 client_->DidInitializeOutputSurface(true); | 212 client_->DidInitializeOutputSurface(true); |
| 210 return CreateSucceeded; | 213 return CreateSucceeded; |
| 211 } | 214 } |
| 212 | 215 |
| 213 // Failure path. | 216 // Failure path. |
| 214 | 217 |
| 215 client_->DidFailToInitializeOutputSurface(); | 218 client_->DidFailToInitializeOutputSurface(); |
| 216 | 219 |
| 217 // Tolerate a certain number of recreation failures to work around races | 220 // Tolerate a certain number of recreation failures to work around races |
| 218 // in the output-surface-lost machinery. | 221 // in the output-surface-lost machinery. |
| (...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 swap_promise_list_.push_back(swap_promise.Pass()); | 1323 swap_promise_list_.push_back(swap_promise.Pass()); |
| 1321 } | 1324 } |
| 1322 | 1325 |
| 1323 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1326 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
| 1324 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1327 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
| 1325 swap_promise_list_[i]->DidNotSwap(reason); | 1328 swap_promise_list_[i]->DidNotSwap(reason); |
| 1326 swap_promise_list_.clear(); | 1329 swap_promise_list_.clear(); |
| 1327 } | 1330 } |
| 1328 | 1331 |
| 1329 } // namespace cc | 1332 } // namespace cc |
| OLD | NEW |