| 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 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1210 | 1210 |
| 1211 void LayerTreeHost::RegisterViewportLayers( | 1211 void LayerTreeHost::RegisterViewportLayers( |
| 1212 scoped_refptr<Layer> page_scale_layer, | 1212 scoped_refptr<Layer> page_scale_layer, |
| 1213 scoped_refptr<Layer> inner_viewport_scroll_layer, | 1213 scoped_refptr<Layer> inner_viewport_scroll_layer, |
| 1214 scoped_refptr<Layer> outer_viewport_scroll_layer) { | 1214 scoped_refptr<Layer> outer_viewport_scroll_layer) { |
| 1215 page_scale_layer_ = page_scale_layer; | 1215 page_scale_layer_ = page_scale_layer; |
| 1216 inner_viewport_scroll_layer_ = inner_viewport_scroll_layer; | 1216 inner_viewport_scroll_layer_ = inner_viewport_scroll_layer; |
| 1217 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer; | 1217 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer; |
| 1218 } | 1218 } |
| 1219 | 1219 |
| 1220 bool LayerTreeHost::ScheduleMicroBenchmark( | 1220 int LayerTreeHost::ScheduleMicroBenchmark( |
| 1221 const std::string& benchmark_name, | 1221 const std::string& benchmark_name, |
| 1222 scoped_ptr<base::Value> value, | 1222 scoped_ptr<base::Value> value, |
| 1223 const MicroBenchmark::DoneCallback& callback) { | 1223 const MicroBenchmark::DoneCallback& callback) { |
| 1224 return micro_benchmark_controller_.ScheduleRun( | 1224 return micro_benchmark_controller_.ScheduleRun( |
| 1225 benchmark_name, value.Pass(), callback); | 1225 benchmark_name, value.Pass(), callback); |
| 1226 } | 1226 } |
| 1227 | 1227 |
| 1228 bool LayerTreeHost::SendMessageToMicroBenchmark(int id, |
| 1229 scoped_ptr<base::Value> value) { |
| 1230 return micro_benchmark_controller_.SendMessage(id, value.Pass()); |
| 1231 } |
| 1232 |
| 1228 void LayerTreeHost::InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor) { | 1233 void LayerTreeHost::InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor) { |
| 1229 swap_promise_monitor_.insert(monitor); | 1234 swap_promise_monitor_.insert(monitor); |
| 1230 } | 1235 } |
| 1231 | 1236 |
| 1232 void LayerTreeHost::RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor) { | 1237 void LayerTreeHost::RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor) { |
| 1233 swap_promise_monitor_.erase(monitor); | 1238 swap_promise_monitor_.erase(monitor); |
| 1234 } | 1239 } |
| 1235 | 1240 |
| 1236 void LayerTreeHost::NotifySwapPromiseMonitorsOfSetNeedsCommit() { | 1241 void LayerTreeHost::NotifySwapPromiseMonitorsOfSetNeedsCommit() { |
| 1237 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 1242 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
| 1238 for (; it != swap_promise_monitor_.end(); it++) | 1243 for (; it != swap_promise_monitor_.end(); it++) |
| 1239 (*it)->OnSetNeedsCommitOnMain(); | 1244 (*it)->OnSetNeedsCommitOnMain(); |
| 1240 } | 1245 } |
| 1241 | 1246 |
| 1242 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { | 1247 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { |
| 1243 DCHECK(swap_promise); | 1248 DCHECK(swap_promise); |
| 1244 if (swap_promise_list_.size() > kMaxQueuedSwapPromiseNumber) | 1249 if (swap_promise_list_.size() > kMaxQueuedSwapPromiseNumber) |
| 1245 BreakSwapPromises(SwapPromise::SWAP_PROMISE_LIST_OVERFLOW); | 1250 BreakSwapPromises(SwapPromise::SWAP_PROMISE_LIST_OVERFLOW); |
| 1246 swap_promise_list_.push_back(swap_promise.Pass()); | 1251 swap_promise_list_.push_back(swap_promise.Pass()); |
| 1247 } | 1252 } |
| 1248 | 1253 |
| 1249 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1254 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
| 1250 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1255 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
| 1251 swap_promise_list_[i]->DidNotSwap(reason); | 1256 swap_promise_list_[i]->DidNotSwap(reason); |
| 1252 swap_promise_list_.clear(); | 1257 swap_promise_list_.clear(); |
| 1253 } | 1258 } |
| 1254 | 1259 |
| 1255 } // namespace cc | 1260 } // namespace cc |
| OLD | NEW |