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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 } else { | 375 } else { |
376 page_scale_delta = sync_tree->page_scale_delta(); | 376 page_scale_delta = sync_tree->page_scale_delta(); |
377 sent_page_scale_delta = sync_tree->sent_page_scale_delta(); | 377 sent_page_scale_delta = sync_tree->sent_page_scale_delta(); |
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_); |
| 386 latency_info_.Clear(); |
385 | 387 |
386 sync_tree->PassSwapPromises(&swap_promise_list_); | 388 sync_tree->PassSwapPromises(&swap_promise_list_); |
387 | 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, |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 | 698 |
697 void LayerTreeHost::SetVisible(bool visible) { | 699 void LayerTreeHost::SetVisible(bool visible) { |
698 if (visible_ == visible) | 700 if (visible_ == visible) |
699 return; | 701 return; |
700 visible_ = visible; | 702 visible_ = visible; |
701 if (!visible) | 703 if (!visible) |
702 ReduceMemoryUsage(); | 704 ReduceMemoryUsage(); |
703 proxy_->SetVisible(visible); | 705 proxy_->SetVisible(visible); |
704 } | 706 } |
705 | 707 |
| 708 void LayerTreeHost::SetLatencyInfo(const ui::LatencyInfo& latency_info) { |
| 709 latency_info_.MergeWith(latency_info); |
| 710 } |
| 711 |
706 void LayerTreeHost::StartPageScaleAnimation(gfx::Vector2d target_offset, | 712 void LayerTreeHost::StartPageScaleAnimation(gfx::Vector2d target_offset, |
707 bool use_anchor, | 713 bool use_anchor, |
708 float scale, | 714 float scale, |
709 base::TimeDelta duration) { | 715 base::TimeDelta duration) { |
710 pending_page_scale_animation_.reset(new PendingPageScaleAnimation); | 716 pending_page_scale_animation_.reset(new PendingPageScaleAnimation); |
711 pending_page_scale_animation_->target_offset = target_offset; | 717 pending_page_scale_animation_->target_offset = target_offset; |
712 pending_page_scale_animation_->use_anchor = use_anchor; | 718 pending_page_scale_animation_->use_anchor = use_anchor; |
713 pending_page_scale_animation_->scale = scale; | 719 pending_page_scale_animation_->scale = scale; |
714 pending_page_scale_animation_->duration = duration; | 720 pending_page_scale_animation_->duration = duration; |
715 | 721 |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 | 1264 |
1259 bool LayerTreeHost::ScheduleMicroBenchmark( | 1265 bool LayerTreeHost::ScheduleMicroBenchmark( |
1260 const std::string& benchmark_name, | 1266 const std::string& benchmark_name, |
1261 scoped_ptr<base::Value> value, | 1267 scoped_ptr<base::Value> value, |
1262 const MicroBenchmark::DoneCallback& callback) { | 1268 const MicroBenchmark::DoneCallback& callback) { |
1263 return micro_benchmark_controller_.ScheduleRun( | 1269 return micro_benchmark_controller_.ScheduleRun( |
1264 benchmark_name, value.Pass(), callback); | 1270 benchmark_name, value.Pass(), callback); |
1265 } | 1271 } |
1266 | 1272 |
1267 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { | 1273 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { |
| 1274 if (proxy_->HasImplThread()) { |
| 1275 DCHECK(proxy_->CommitRequested() || proxy_->BeginMainFrameRequested()); |
| 1276 } |
1268 DCHECK(swap_promise); | 1277 DCHECK(swap_promise); |
1269 if (swap_promise_list_.size() > kMaxQueuedSwapPromiseNumber) | 1278 if (swap_promise_list_.size() > kMaxQueuedSwapPromiseNumber) |
1270 BreakSwapPromises(SwapPromise::SWAP_PROMISE_LIST_OVERFLOW); | 1279 BreakSwapPromises(SwapPromise::SWAP_PROMISE_LIST_OVERFLOW); |
1271 swap_promise_list_.push_back(swap_promise.Pass()); | 1280 swap_promise_list_.push_back(swap_promise.Pass()); |
1272 } | 1281 } |
1273 | 1282 |
1274 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1283 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
1275 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1284 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
1276 swap_promise_list_[i]->DidNotSwap(reason); | 1285 swap_promise_list_[i]->DidNotSwap(reason); |
1277 swap_promise_list_.clear(); | 1286 swap_promise_list_.clear(); |
1278 } | 1287 } |
1279 | 1288 |
1280 } // namespace cc | 1289 } // namespace cc |
OLD | NEW |