Chromium Code Reviews| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 proxy_->Start(); | 154 proxy_->Start(); |
| 155 if (settings_.accelerated_animation_enabled) { | 155 if (settings_.accelerated_animation_enabled) { |
| 156 animation_registrar_->set_supports_scroll_animations( | 156 animation_registrar_->set_supports_scroll_animations( |
| 157 proxy_->SupportsImplScrolling()); | 157 proxy_->SupportsImplScrolling()); |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 | 160 |
| 161 LayerTreeHost::~LayerTreeHost() { | 161 LayerTreeHost::~LayerTreeHost() { |
| 162 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); | 162 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); |
| 163 | 163 |
| 164 CHECK(swap_promise_monitor_.empty()); | 164 CHECK(swap_promise_monitor_.empty()); |
|
danakj
2014/08/26 20:52:31
Can you change this to a DCHECK now?
| |
| 165 | 165 |
| 166 BreakSwapPromises(SwapPromise::COMMIT_FAILS); | 166 BreakSwapPromises(SwapPromise::COMMIT_FAILS); |
| 167 | 167 |
| 168 overhang_ui_resource_.reset(); | 168 overhang_ui_resource_.reset(); |
| 169 | 169 |
| 170 if (root_layer_.get()) | 170 if (root_layer_.get()) |
| 171 root_layer_->SetLayerTreeHost(NULL); | 171 root_layer_->SetLayerTreeHost(NULL); |
| 172 | 172 |
| 173 if (proxy_) { | 173 if (proxy_) { |
| 174 DCHECK(proxy_->IsMainThread()); | 174 DCHECK(proxy_->IsMainThread()); |
| 175 proxy_->Stop(); | 175 proxy_->Stop(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 // We must clear any pointers into the layer tree prior to destroying it. | 178 // We must clear any pointers into the layer tree prior to destroying it. |
| 179 RegisterViewportLayers(NULL, NULL, NULL); | 179 RegisterViewportLayers(NULL, NULL, NULL); |
| 180 | 180 |
| 181 if (root_layer_.get()) { | 181 if (root_layer_.get()) { |
| 182 // The layer tree must be destroyed before the layer tree host. We've | 182 // The layer tree must be destroyed before the layer tree host. We've |
| 183 // made a contract with our animation controllers that the registrar | 183 // made a contract with our animation controllers that the registrar |
| 184 // will outlive them, and we must make good. | 184 // will outlive them, and we must make good. |
| 185 root_layer_ = NULL; | 185 root_layer_ = NULL; |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 | 188 |
| 189 void LayerTreeHost::SetLayerTreeHostClientReady() { | 189 void LayerTreeHost::SetLayerTreeHostClientReady() { |
| 190 proxy_->SetLayerTreeHostClientReady(); | 190 proxy_->SetLayerTreeHostClientReady(); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void LayerTreeHost::SetLayerTreeHostClientFinished() { | |
| 194 proxy_->SetLayerTreeHostClientFinished(); | |
| 195 } | |
| 196 | |
| 193 static void LayerTreeHostOnOutputSurfaceCreatedCallback(Layer* layer) { | 197 static void LayerTreeHostOnOutputSurfaceCreatedCallback(Layer* layer) { |
| 194 layer->OnOutputSurfaceCreated(); | 198 layer->OnOutputSurfaceCreated(); |
| 195 } | 199 } |
| 196 | 200 |
| 197 void LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(bool success) { | 201 void LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(bool success) { |
| 198 DCHECK(output_surface_lost_); | 202 DCHECK(output_surface_lost_); |
| 199 TRACE_EVENT1("cc", | 203 TRACE_EVENT1("cc", |
| 200 "LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted", | 204 "LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted", |
| 201 "success", | 205 "success", |
| 202 success); | 206 success); |
| (...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1301 swap_promise_list_.push_back(swap_promise.Pass()); | 1305 swap_promise_list_.push_back(swap_promise.Pass()); |
| 1302 } | 1306 } |
| 1303 | 1307 |
| 1304 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1308 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
| 1305 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1309 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
| 1306 swap_promise_list_[i]->DidNotSwap(reason); | 1310 swap_promise_list_[i]->DidNotSwap(reason); |
| 1307 swap_promise_list_.clear(); | 1311 swap_promise_list_.clear(); |
| 1308 } | 1312 } |
| 1309 | 1313 |
| 1310 } // namespace cc | 1314 } // namespace cc |
| OLD | NEW |