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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 sync_tree->set_sent_page_scale_delta(1.f); | 378 sync_tree->set_sent_page_scale_delta(1.f); |
379 } | 379 } |
380 | 380 |
381 sync_tree->SetPageScaleFactorAndLimits(page_scale_factor_, | 381 sync_tree->SetPageScaleFactorAndLimits(page_scale_factor_, |
382 min_page_scale_factor_, | 382 min_page_scale_factor_, |
383 max_page_scale_factor_); | 383 max_page_scale_factor_); |
384 sync_tree->SetPageScaleDelta(page_scale_delta / sent_page_scale_delta); | 384 sync_tree->SetPageScaleDelta(page_scale_delta / sent_page_scale_delta); |
385 sync_tree->SetLatencyInfo(latency_info_); | 385 sync_tree->SetLatencyInfo(latency_info_); |
386 latency_info_.Clear(); | 386 latency_info_.Clear(); |
387 | 387 |
| 388 sync_tree->TakeSwapPromises(&swap_promise_list_); |
| 389 |
388 host_impl->SetViewportSize(device_viewport_size_); | 390 host_impl->SetViewportSize(device_viewport_size_); |
389 host_impl->SetOverdrawBottomHeight(overdraw_bottom_height_); | 391 host_impl->SetOverdrawBottomHeight(overdraw_bottom_height_); |
390 host_impl->SetDeviceScaleFactor(device_scale_factor_); | 392 host_impl->SetDeviceScaleFactor(device_scale_factor_); |
391 host_impl->SetDebugState(debug_state_); | 393 host_impl->SetDebugState(debug_state_); |
392 if (pending_page_scale_animation_) { | 394 if (pending_page_scale_animation_) { |
393 host_impl->StartPageScaleAnimation( | 395 host_impl->StartPageScaleAnimation( |
394 pending_page_scale_animation_->target_offset, | 396 pending_page_scale_animation_->target_offset, |
395 pending_page_scale_animation_->use_anchor, | 397 pending_page_scale_animation_->use_anchor, |
396 pending_page_scale_animation_->scale, | 398 pending_page_scale_animation_->scale, |
397 pending_page_scale_animation_->duration); | 399 pending_page_scale_animation_->duration); |
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 } | 1259 } |
1258 | 1260 |
1259 bool LayerTreeHost::ScheduleMicroBenchmark( | 1261 bool LayerTreeHost::ScheduleMicroBenchmark( |
1260 const std::string& benchmark_name, | 1262 const std::string& benchmark_name, |
1261 scoped_ptr<base::Value> value, | 1263 scoped_ptr<base::Value> value, |
1262 const MicroBenchmark::DoneCallback& callback) { | 1264 const MicroBenchmark::DoneCallback& callback) { |
1263 return micro_benchmark_controller_.ScheduleRun( | 1265 return micro_benchmark_controller_.ScheduleRun( |
1264 benchmark_name, value.Pass(), callback); | 1266 benchmark_name, value.Pass(), callback); |
1265 } | 1267 } |
1266 | 1268 |
| 1269 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { |
| 1270 if (proxy_->HasImplThread()) { |
| 1271 DCHECK(proxy_->CommitRequested() || proxy_->BeginMainFrameRequested()); |
| 1272 } |
| 1273 if (swap_promise_list_.size() > kMaxQueuedSwapPromiseNumber) |
| 1274 BreakSwapPromises(SwapPromise::SWAP_PROMISE_LIST_OVERFLOW); |
| 1275 swap_promise_list_.push_back(swap_promise.Pass()); |
| 1276 } |
| 1277 |
| 1278 void LayerTreeHost::FinishSwapPromises() { |
| 1279 for (size_t i = 0; i < swap_promise_list_.size(); i++) { |
| 1280 swap_promise_list_[i]->DidSwap(); |
| 1281 } |
| 1282 swap_promise_list_.clear(); |
| 1283 } |
| 1284 |
| 1285 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
| 1286 for (size_t i = 0; i < swap_promise_list_.size(); i++) { |
| 1287 swap_promise_list_[i]->DidNotSwap(reason); |
| 1288 } |
| 1289 swap_promise_list_.clear(); |
| 1290 } |
| 1291 |
1267 } // namespace cc | 1292 } // namespace cc |
OLD | NEW |