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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 } | 1234 } |
1235 | 1235 |
1236 void LayerTreeHost::NotifySwapPromiseMonitorsOfSetNeedsCommit() { | 1236 void LayerTreeHost::NotifySwapPromiseMonitorsOfSetNeedsCommit() { |
1237 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 1237 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
1238 for (; it != swap_promise_monitor_.end(); it++) | 1238 for (; it != swap_promise_monitor_.end(); it++) |
1239 (*it)->OnSetNeedsCommitOnMain(); | 1239 (*it)->OnSetNeedsCommitOnMain(); |
1240 } | 1240 } |
1241 | 1241 |
1242 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { | 1242 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { |
1243 DCHECK(swap_promise); | 1243 DCHECK(swap_promise); |
1244 if (swap_promise_list_.size() > kMaxQueuedSwapPromiseNumber) | |
1245 BreakSwapPromises(SwapPromise::SWAP_PROMISE_LIST_OVERFLOW); | |
1246 swap_promise_list_.push_back(swap_promise.Pass()); | 1244 swap_promise_list_.push_back(swap_promise.Pass()); |
1247 } | 1245 } |
1248 | 1246 |
1249 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1247 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
1250 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1248 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
1251 swap_promise_list_[i]->DidNotSwap(reason); | 1249 swap_promise_list_[i]->DidNotSwap(reason); |
1252 swap_promise_list_.clear(); | 1250 swap_promise_list_.clear(); |
1253 } | 1251 } |
1254 | 1252 |
1255 } // namespace cc | 1253 } // namespace cc |
OLD | NEW |