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