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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 next_ui_resource_id_(1), | 99 next_ui_resource_id_(1), |
100 inside_begin_main_frame_(false), | 100 inside_begin_main_frame_(false), |
101 needs_full_tree_sync_(true), | 101 needs_full_tree_sync_(true), |
102 client_(client), | 102 client_(client), |
103 source_frame_number_(0), | 103 source_frame_number_(0), |
104 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), | 104 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), |
105 output_surface_lost_(true), | 105 output_surface_lost_(true), |
106 num_failed_recreate_attempts_(0), | 106 num_failed_recreate_attempts_(0), |
107 settings_(settings), | 107 settings_(settings), |
108 debug_state_(settings.initial_debug_state), | 108 debug_state_(settings.initial_debug_state), |
109 overdraw_bottom_height_(0.f), | 109 top_controls_layout_height_(0.f), |
110 device_scale_factor_(1.f), | 110 device_scale_factor_(1.f), |
111 visible_(true), | 111 visible_(true), |
112 page_scale_factor_(1.f), | 112 page_scale_factor_(1.f), |
113 min_page_scale_factor_(1.f), | 113 min_page_scale_factor_(1.f), |
114 max_page_scale_factor_(1.f), | 114 max_page_scale_factor_(1.f), |
115 has_gpu_rasterization_trigger_(false), | 115 has_gpu_rasterization_trigger_(false), |
116 content_is_suitable_for_gpu_rasterization_(true), | 116 content_is_suitable_for_gpu_rasterization_(true), |
117 gpu_rasterization_histogram_recorded_(false), | 117 gpu_rasterization_histogram_recorded_(false), |
118 background_color_(SK_ColorWHITE), | 118 background_color_(SK_ColorWHITE), |
119 has_transparent_background_(false), | 119 has_transparent_background_(false), |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 max_page_scale_factor_, | 344 max_page_scale_factor_, |
345 page_scale_delta); | 345 page_scale_delta); |
346 sync_tree->set_sent_page_scale_delta(1.f); | 346 sync_tree->set_sent_page_scale_delta(1.f); |
347 | 347 |
348 sync_tree->PassSwapPromises(&swap_promise_list_); | 348 sync_tree->PassSwapPromises(&swap_promise_list_); |
349 | 349 |
350 host_impl->SetUseGpuRasterization(UseGpuRasterization()); | 350 host_impl->SetUseGpuRasterization(UseGpuRasterization()); |
351 RecordGpuRasterizationHistogram(); | 351 RecordGpuRasterizationHistogram(); |
352 | 352 |
353 host_impl->SetViewportSize(device_viewport_size_); | 353 host_impl->SetViewportSize(device_viewport_size_); |
354 host_impl->SetOverdrawBottomHeight(overdraw_bottom_height_); | 354 host_impl->SetTopControlsLayoutHeight(top_controls_layout_height_); |
355 host_impl->SetDeviceScaleFactor(device_scale_factor_); | 355 host_impl->SetDeviceScaleFactor(device_scale_factor_); |
356 host_impl->SetDebugState(debug_state_); | 356 host_impl->SetDebugState(debug_state_); |
357 if (pending_page_scale_animation_) { | 357 if (pending_page_scale_animation_) { |
358 host_impl->StartPageScaleAnimation( | 358 host_impl->StartPageScaleAnimation( |
359 pending_page_scale_animation_->target_offset, | 359 pending_page_scale_animation_->target_offset, |
360 pending_page_scale_animation_->use_anchor, | 360 pending_page_scale_animation_->use_anchor, |
361 pending_page_scale_animation_->scale, | 361 pending_page_scale_animation_->scale, |
362 pending_page_scale_animation_->duration); | 362 pending_page_scale_animation_->duration); |
363 pending_page_scale_animation_.reset(); | 363 pending_page_scale_animation_.reset(); |
364 } | 364 } |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 | 620 |
621 void LayerTreeHost::SetViewportSize(const gfx::Size& device_viewport_size) { | 621 void LayerTreeHost::SetViewportSize(const gfx::Size& device_viewport_size) { |
622 if (device_viewport_size == device_viewport_size_) | 622 if (device_viewport_size == device_viewport_size_) |
623 return; | 623 return; |
624 | 624 |
625 device_viewport_size_ = device_viewport_size; | 625 device_viewport_size_ = device_viewport_size; |
626 | 626 |
627 SetNeedsCommit(); | 627 SetNeedsCommit(); |
628 } | 628 } |
629 | 629 |
630 void LayerTreeHost::SetOverdrawBottomHeight(float overdraw_bottom_height) { | 630 void LayerTreeHost::SetTopControlsLayoutHeight( |
631 if (overdraw_bottom_height_ == overdraw_bottom_height) | 631 float top_controls_layout_height) { |
| 632 if (top_controls_layout_height_ == top_controls_layout_height) |
632 return; | 633 return; |
633 | 634 |
634 overdraw_bottom_height_ = overdraw_bottom_height; | 635 top_controls_layout_height_ = top_controls_layout_height; |
635 SetNeedsCommit(); | 636 SetNeedsCommit(); |
636 } | 637 } |
637 | 638 |
638 void LayerTreeHost::ApplyPageScaleDeltaFromImplSide(float page_scale_delta) { | 639 void LayerTreeHost::ApplyPageScaleDeltaFromImplSide(float page_scale_delta) { |
639 DCHECK(CommitRequested()); | 640 DCHECK(CommitRequested()); |
640 page_scale_factor_ *= page_scale_delta; | 641 page_scale_factor_ *= page_scale_delta; |
641 } | 642 } |
642 | 643 |
643 void LayerTreeHost::SetPageScaleFactorAndLimits(float page_scale_factor, | 644 void LayerTreeHost::SetPageScaleFactorAndLimits(float page_scale_factor, |
644 float min_page_scale_factor, | 645 float min_page_scale_factor, |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 swap_promise_list_.push_back(swap_promise.Pass()); | 1297 swap_promise_list_.push_back(swap_promise.Pass()); |
1297 } | 1298 } |
1298 | 1299 |
1299 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1300 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
1300 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1301 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
1301 swap_promise_list_[i]->DidNotSwap(reason); | 1302 swap_promise_list_[i]->DidNotSwap(reason); |
1302 swap_promise_list_.clear(); | 1303 swap_promise_list_.clear(); |
1303 } | 1304 } |
1304 | 1305 |
1305 } // namespace cc | 1306 } // namespace cc |
OLD | NEW |