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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 meta_information_sequence_number_(1), | 94 meta_information_sequence_number_(1), |
95 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), | 95 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), |
96 output_surface_lost_(true), | 96 output_surface_lost_(true), |
97 settings_(*params->settings), | 97 settings_(*params->settings), |
98 debug_state_(settings_.initial_debug_state), | 98 debug_state_(settings_.initial_debug_state), |
99 top_controls_shrink_blink_size_(false), | 99 top_controls_shrink_blink_size_(false), |
100 top_controls_height_(0.f), | 100 top_controls_height_(0.f), |
101 top_controls_shown_ratio_(0.f), | 101 top_controls_shown_ratio_(0.f), |
102 hide_pinch_scrollbars_near_min_scale_(false), | 102 hide_pinch_scrollbars_near_min_scale_(false), |
103 device_scale_factor_(1.f), | 103 device_scale_factor_(1.f), |
104 visible_(true), | 104 visible_(false), |
105 page_scale_factor_(1.f), | 105 page_scale_factor_(1.f), |
106 min_page_scale_factor_(1.f), | 106 min_page_scale_factor_(1.f), |
107 max_page_scale_factor_(1.f), | 107 max_page_scale_factor_(1.f), |
108 has_gpu_rasterization_trigger_(false), | 108 has_gpu_rasterization_trigger_(false), |
109 content_is_suitable_for_gpu_rasterization_(true), | 109 content_is_suitable_for_gpu_rasterization_(true), |
110 gpu_rasterization_histogram_recorded_(false), | 110 gpu_rasterization_histogram_recorded_(false), |
111 background_color_(SK_ColorWHITE), | 111 background_color_(SK_ColorWHITE), |
112 has_transparent_background_(false), | 112 has_transparent_background_(false), |
113 did_complete_scale_animation_(false), | 113 did_complete_scale_animation_(false), |
114 in_paint_layer_contents_(false), | 114 in_paint_layer_contents_(false), |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 RegisterViewportLayers(NULL, NULL, NULL, NULL); | 196 RegisterViewportLayers(NULL, NULL, NULL, NULL); |
197 | 197 |
198 if (root_layer_.get()) { | 198 if (root_layer_.get()) { |
199 // The layer tree must be destroyed before the layer tree host. We've | 199 // The layer tree must be destroyed before the layer tree host. We've |
200 // made a contract with our animation controllers that the registrar | 200 // made a contract with our animation controllers that the registrar |
201 // will outlive them, and we must make good. | 201 // will outlive them, and we must make good. |
202 root_layer_ = NULL; | 202 root_layer_ = NULL; |
203 } | 203 } |
204 } | 204 } |
205 | 205 |
206 void LayerTreeHost::SetLayerTreeHostClientReady() { | |
207 proxy_->SetLayerTreeHostClientReady(); | |
208 } | |
209 | |
210 void LayerTreeHost::WillBeginMainFrame() { | 206 void LayerTreeHost::WillBeginMainFrame() { |
211 devtools_instrumentation::WillBeginMainThreadFrame(id(), | 207 devtools_instrumentation::WillBeginMainThreadFrame(id(), |
212 source_frame_number()); | 208 source_frame_number()); |
213 client_->WillBeginMainFrame(); | 209 client_->WillBeginMainFrame(); |
214 } | 210 } |
215 | 211 |
216 void LayerTreeHost::DidBeginMainFrame() { | 212 void LayerTreeHost::DidBeginMainFrame() { |
217 client_->DidBeginMainFrame(); | 213 client_->DidBeginMainFrame(); |
218 } | 214 } |
219 | 215 |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 void LayerTreeHost::NotifyInputThrottledUntilCommit() { | 671 void LayerTreeHost::NotifyInputThrottledUntilCommit() { |
676 proxy_->NotifyInputThrottledUntilCommit(); | 672 proxy_->NotifyInputThrottledUntilCommit(); |
677 } | 673 } |
678 | 674 |
679 void LayerTreeHost::LayoutAndUpdateLayers() { | 675 void LayerTreeHost::LayoutAndUpdateLayers() { |
680 DCHECK(!proxy_->HasImplThread()); | 676 DCHECK(!proxy_->HasImplThread()); |
681 // This function is only valid when not using the scheduler. | 677 // This function is only valid when not using the scheduler. |
682 DCHECK(!settings_.single_thread_proxy_scheduler); | 678 DCHECK(!settings_.single_thread_proxy_scheduler); |
683 SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get()); | 679 SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get()); |
684 | 680 |
685 SetLayerTreeHostClientReady(); | |
686 proxy->LayoutAndUpdateLayers(); | 681 proxy->LayoutAndUpdateLayers(); |
687 } | 682 } |
688 | 683 |
689 void LayerTreeHost::Composite(base::TimeTicks frame_begin_time) { | 684 void LayerTreeHost::Composite(base::TimeTicks frame_begin_time) { |
690 DCHECK(!proxy_->HasImplThread()); | 685 DCHECK(!proxy_->HasImplThread()); |
691 // This function is only valid when not using the scheduler. | 686 // This function is only valid when not using the scheduler. |
692 DCHECK(!settings_.single_thread_proxy_scheduler); | 687 DCHECK(!settings_.single_thread_proxy_scheduler); |
693 SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get()); | 688 SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get()); |
694 | 689 |
695 SetLayerTreeHostClientReady(); | |
696 proxy->CompositeImmediately(frame_begin_time); | 690 proxy->CompositeImmediately(frame_begin_time); |
697 } | 691 } |
698 | 692 |
699 bool LayerTreeHost::UpdateLayers() { | 693 bool LayerTreeHost::UpdateLayers() { |
700 DCHECK(!output_surface_lost_); | 694 DCHECK(!output_surface_lost_); |
701 if (!root_layer()) | 695 if (!root_layer()) |
702 return false; | 696 return false; |
703 DCHECK(!root_layer()->parent()); | 697 DCHECK(!root_layer()->parent()); |
704 bool result = DoUpdateLayers(root_layer()); | 698 bool result = DoUpdateLayers(root_layer()); |
705 micro_benchmark_controller_.DidUpdateLayers(); | 699 micro_benchmark_controller_.DidUpdateLayers(); |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) | 1227 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) |
1234 : false; | 1228 : false; |
1235 } | 1229 } |
1236 | 1230 |
1237 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { | 1231 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { |
1238 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) | 1232 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) |
1239 : false; | 1233 : false; |
1240 } | 1234 } |
1241 | 1235 |
1242 } // namespace cc | 1236 } // namespace cc |
OLD | NEW |