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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 source_frame_number_(0), | 92 source_frame_number_(0), |
93 meta_information_sequence_number_(1), | 93 meta_information_sequence_number_(1), |
94 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), | 94 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), |
95 output_surface_lost_(true), | 95 output_surface_lost_(true), |
96 settings_(*params->settings), | 96 settings_(*params->settings), |
97 debug_state_(settings_.initial_debug_state), | 97 debug_state_(settings_.initial_debug_state), |
98 top_controls_shrink_blink_size_(false), | 98 top_controls_shrink_blink_size_(false), |
99 top_controls_height_(0.f), | 99 top_controls_height_(0.f), |
100 top_controls_shown_ratio_(0.f), | 100 top_controls_shown_ratio_(0.f), |
101 device_scale_factor_(1.f), | 101 device_scale_factor_(1.f), |
102 painted_device_scale_factor_(0.f), | |
danakj
2015/10/22 23:15:29
default to 1?
oshima
2015/10/23 18:05:36
I was using 0.f as a way to tell if which should b
| |
102 visible_(false), | 103 visible_(false), |
103 page_scale_factor_(1.f), | 104 page_scale_factor_(1.f), |
104 min_page_scale_factor_(1.f), | 105 min_page_scale_factor_(1.f), |
105 max_page_scale_factor_(1.f), | 106 max_page_scale_factor_(1.f), |
106 has_gpu_rasterization_trigger_(false), | 107 has_gpu_rasterization_trigger_(false), |
107 content_is_suitable_for_gpu_rasterization_(true), | 108 content_is_suitable_for_gpu_rasterization_(true), |
108 gpu_rasterization_histogram_recorded_(false), | 109 gpu_rasterization_histogram_recorded_(false), |
109 background_color_(SK_ColorWHITE), | 110 background_color_(SK_ColorWHITE), |
110 has_transparent_background_(false), | 111 has_transparent_background_(false), |
111 did_complete_scale_animation_(false), | 112 did_complete_scale_animation_(false), |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
304 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); | 305 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); |
305 host_impl->SetContentIsSuitableForGpuRasterization( | 306 host_impl->SetContentIsSuitableForGpuRasterization( |
306 content_is_suitable_for_gpu_rasterization_); | 307 content_is_suitable_for_gpu_rasterization_); |
307 RecordGpuRasterizationHistogram(); | 308 RecordGpuRasterizationHistogram(); |
308 | 309 |
309 host_impl->SetViewportSize(device_viewport_size_); | 310 host_impl->SetViewportSize(device_viewport_size_); |
310 // TODO(senorblanco): Move this up so that it happens before GPU rasterization | 311 // TODO(senorblanco): Move this up so that it happens before GPU rasterization |
311 // properties are set, since those trigger an update of GPU rasterization | 312 // properties are set, since those trigger an update of GPU rasterization |
312 // status, which depends on the device scale factor. (crbug.com/535700) | 313 // status, which depends on the device scale factor. (crbug.com/535700) |
313 sync_tree->SetDeviceScaleFactor(device_scale_factor_); | 314 sync_tree->SetDeviceScaleFactor(device_scale_factor_); |
315 sync_tree->SetPaintedDeviceScaleFactor(painted_device_scale_factor_); | |
314 host_impl->SetDebugState(debug_state_); | 316 host_impl->SetDebugState(debug_state_); |
315 if (pending_page_scale_animation_) { | 317 if (pending_page_scale_animation_) { |
316 sync_tree->SetPendingPageScaleAnimation( | 318 sync_tree->SetPendingPageScaleAnimation( |
317 pending_page_scale_animation_.Pass()); | 319 pending_page_scale_animation_.Pass()); |
318 } | 320 } |
319 | 321 |
320 if (!ui_resource_request_queue_.empty()) { | 322 if (!ui_resource_request_queue_.empty()) { |
321 sync_tree->set_ui_resource_request_queue(ui_resource_request_queue_); | 323 sync_tree->set_ui_resource_request_queue(ui_resource_request_queue_); |
322 ui_resource_request_queue_.clear(); | 324 ui_resource_request_queue_.clear(); |
323 } | 325 } |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
581 TRACE_EVENT_INSTANT1("cc", | 583 TRACE_EVENT_INSTANT1("cc", |
582 "LayerTreeHost::SetHasGpuRasterizationTrigger", | 584 "LayerTreeHost::SetHasGpuRasterizationTrigger", |
583 TRACE_EVENT_SCOPE_THREAD, | 585 TRACE_EVENT_SCOPE_THREAD, |
584 "has_trigger", | 586 "has_trigger", |
585 has_gpu_rasterization_trigger_); | 587 has_gpu_rasterization_trigger_); |
586 } | 588 } |
587 | 589 |
588 void LayerTreeHost::SetViewportSize(const gfx::Size& device_viewport_size) { | 590 void LayerTreeHost::SetViewportSize(const gfx::Size& device_viewport_size) { |
589 if (device_viewport_size == device_viewport_size_) | 591 if (device_viewport_size == device_viewport_size_) |
590 return; | 592 return; |
591 | |
danakj
2015/10/22 23:15:29
unrelated change
oshima
2015/10/23 18:05:36
Done.
| |
592 device_viewport_size_ = device_viewport_size; | 593 device_viewport_size_ = device_viewport_size; |
593 | 594 |
594 SetPropertyTreesNeedRebuild(); | 595 SetPropertyTreesNeedRebuild(); |
595 SetNeedsCommit(); | 596 SetNeedsCommit(); |
596 } | 597 } |
597 | 598 |
598 void LayerTreeHost::SetTopControlsHeight(float height, bool shrink) { | 599 void LayerTreeHost::SetTopControlsHeight(float height, bool shrink) { |
599 if (top_controls_height_ == height && | 600 if (top_controls_height_ == height && |
600 top_controls_shrink_blink_size_ == shrink) | 601 top_controls_shrink_blink_size_ == shrink) |
601 return; | 602 return; |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
864 | 865 |
865 void LayerTreeHost::SetDeviceScaleFactor(float device_scale_factor) { | 866 void LayerTreeHost::SetDeviceScaleFactor(float device_scale_factor) { |
866 if (device_scale_factor == device_scale_factor_) | 867 if (device_scale_factor == device_scale_factor_) |
867 return; | 868 return; |
868 device_scale_factor_ = device_scale_factor; | 869 device_scale_factor_ = device_scale_factor; |
869 | 870 |
870 property_trees_.needs_rebuild = true; | 871 property_trees_.needs_rebuild = true; |
871 SetNeedsCommit(); | 872 SetNeedsCommit(); |
872 } | 873 } |
873 | 874 |
875 void LayerTreeHost::SetPaintedDeviceScaleFactor( | |
876 float painted_device_scale_factor) { | |
877 if (painted_device_scale_factor == painted_device_scale_factor_) | |
878 return; | |
879 painted_device_scale_factor_ = painted_device_scale_factor; | |
880 | |
881 property_trees_.needs_rebuild = true; | |
danakj
2015/10/22 23:15:29
i don't think this is true, it's not used in prope
oshima
2015/10/23 18:05:36
Done.
| |
882 SetNeedsCommit(); | |
883 } | |
884 | |
874 void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints, | 885 void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints, |
875 TopControlsState current, | 886 TopControlsState current, |
876 bool animate) { | 887 bool animate) { |
877 // Top controls are only used in threaded mode. | 888 // Top controls are only used in threaded mode. |
878 DCHECK(proxy_->HasImplThread()); | 889 DCHECK(proxy_->HasImplThread()); |
879 proxy_->UpdateTopControlsState(constraints, current, animate); | 890 proxy_->UpdateTopControlsState(constraints, current, animate); |
880 } | 891 } |
881 | 892 |
882 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) { | 893 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) { |
883 if (!settings_.accelerated_animation_enabled) | 894 if (!settings_.accelerated_animation_enabled) |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1216 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) | 1227 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) |
1217 : false; | 1228 : false; |
1218 } | 1229 } |
1219 | 1230 |
1220 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { | 1231 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { |
1221 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) | 1232 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) |
1222 : false; | 1233 : false; |
1223 } | 1234 } |
1224 | 1235 |
1225 } // namespace cc | 1236 } // namespace cc |
OLD | NEW |