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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { | 140 void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { |
141 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); | 141 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); |
142 | 142 |
143 proxy_ = proxy.Pass(); | 143 proxy_ = proxy.Pass(); |
144 proxy_->Start(); | 144 proxy_->Start(); |
145 } | 145 } |
146 | 146 |
147 LayerTreeHost::~LayerTreeHost() { | 147 LayerTreeHost::~LayerTreeHost() { |
148 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); | 148 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); |
149 | 149 |
| 150 BreakSwapPromises(SwapPromise::COMMIT_FAILS); |
| 151 |
150 overhang_ui_resource_.reset(); | 152 overhang_ui_resource_.reset(); |
151 | 153 |
152 if (root_layer_.get()) | 154 if (root_layer_.get()) |
153 root_layer_->SetLayerTreeHost(NULL); | 155 root_layer_->SetLayerTreeHost(NULL); |
154 | 156 |
155 if (proxy_) { | 157 if (proxy_) { |
156 DCHECK(proxy_->IsMainThread()); | 158 DCHECK(proxy_->IsMainThread()); |
157 proxy_->Stop(); | 159 proxy_->Stop(); |
158 } | 160 } |
159 | 161 |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 } | 1245 } |
1244 | 1246 |
1245 void LayerTreeHost::NotifySwapPromiseMonitorsOfSetNeedsCommit() { | 1247 void LayerTreeHost::NotifySwapPromiseMonitorsOfSetNeedsCommit() { |
1246 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 1248 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
1247 for (; it != swap_promise_monitor_.end(); it++) | 1249 for (; it != swap_promise_monitor_.end(); it++) |
1248 (*it)->OnSetNeedsCommitOnMain(); | 1250 (*it)->OnSetNeedsCommitOnMain(); |
1249 } | 1251 } |
1250 | 1252 |
1251 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { | 1253 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { |
1252 DCHECK(swap_promise); | 1254 DCHECK(swap_promise); |
1253 if (swap_promise_list_.size() > kMaxQueuedSwapPromiseNumber) | |
1254 BreakSwapPromises(SwapPromise::SWAP_PROMISE_LIST_OVERFLOW); | |
1255 swap_promise_list_.push_back(swap_promise.Pass()); | 1255 swap_promise_list_.push_back(swap_promise.Pass()); |
1256 } | 1256 } |
1257 | 1257 |
1258 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1258 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
1259 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1259 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
1260 swap_promise_list_[i]->DidNotSwap(reason); | 1260 swap_promise_list_[i]->DidNotSwap(reason); |
1261 swap_promise_list_.clear(); | 1261 swap_promise_list_.clear(); |
1262 } | 1262 } |
1263 | 1263 |
1264 } // namespace cc | 1264 } // namespace cc |
OLD | NEW |