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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 proxy_->Start(); | 153 proxy_->Start(); |
154 if (settings_.accelerated_animation_enabled) { | 154 if (settings_.accelerated_animation_enabled) { |
155 animation_registrar_->set_supports_scroll_animations( | 155 animation_registrar_->set_supports_scroll_animations( |
156 proxy_->SupportsImplScrolling()); | 156 proxy_->SupportsImplScrolling()); |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 LayerTreeHost::~LayerTreeHost() { | 160 LayerTreeHost::~LayerTreeHost() { |
161 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); | 161 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); |
162 | 162 |
| 163 BreakSwapPromises(SwapPromise::COMMIT_FAILS); |
| 164 |
163 overhang_ui_resource_.reset(); | 165 overhang_ui_resource_.reset(); |
164 | 166 |
165 if (root_layer_.get()) | 167 if (root_layer_.get()) |
166 root_layer_->SetLayerTreeHost(NULL); | 168 root_layer_->SetLayerTreeHost(NULL); |
167 | 169 |
168 if (proxy_) { | 170 if (proxy_) { |
169 DCHECK(proxy_->IsMainThread()); | 171 DCHECK(proxy_->IsMainThread()); |
170 proxy_->Stop(); | 172 proxy_->Stop(); |
171 } | 173 } |
172 | 174 |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 } | 1272 } |
1271 | 1273 |
1272 void LayerTreeHost::NotifySwapPromiseMonitorsOfSetNeedsCommit() { | 1274 void LayerTreeHost::NotifySwapPromiseMonitorsOfSetNeedsCommit() { |
1273 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 1275 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
1274 for (; it != swap_promise_monitor_.end(); it++) | 1276 for (; it != swap_promise_monitor_.end(); it++) |
1275 (*it)->OnSetNeedsCommitOnMain(); | 1277 (*it)->OnSetNeedsCommitOnMain(); |
1276 } | 1278 } |
1277 | 1279 |
1278 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { | 1280 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { |
1279 DCHECK(swap_promise); | 1281 DCHECK(swap_promise); |
1280 if (swap_promise_list_.size() > kMaxQueuedSwapPromiseNumber) | |
1281 BreakSwapPromises(SwapPromise::SWAP_PROMISE_LIST_OVERFLOW); | |
1282 swap_promise_list_.push_back(swap_promise.Pass()); | 1282 swap_promise_list_.push_back(swap_promise.Pass()); |
1283 } | 1283 } |
1284 | 1284 |
1285 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1285 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
1286 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1286 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
1287 swap_promise_list_[i]->DidNotSwap(reason); | 1287 swap_promise_list_[i]->DidNotSwap(reason); |
1288 swap_promise_list_.clear(); | 1288 swap_promise_list_.clear(); |
1289 } | 1289 } |
1290 | 1290 |
1291 } // namespace cc | 1291 } // namespace cc |
OLD | NEW |