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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 visible_(true), | 123 visible_(true), |
124 page_scale_factor_(1.f), | 124 page_scale_factor_(1.f), |
125 min_page_scale_factor_(1.f), | 125 min_page_scale_factor_(1.f), |
126 max_page_scale_factor_(1.f), | 126 max_page_scale_factor_(1.f), |
127 has_gpu_rasterization_trigger_(false), | 127 has_gpu_rasterization_trigger_(false), |
128 content_is_suitable_for_gpu_rasterization_(true), | 128 content_is_suitable_for_gpu_rasterization_(true), |
129 gpu_rasterization_histogram_recorded_(false), | 129 gpu_rasterization_histogram_recorded_(false), |
130 background_color_(SK_ColorWHITE), | 130 background_color_(SK_ColorWHITE), |
131 has_transparent_background_(false), | 131 has_transparent_background_(false), |
132 partial_texture_update_requests_(0), | 132 partial_texture_update_requests_(0), |
| 133 did_complete_scale_animation_(false), |
133 in_paint_layer_contents_(false), | 134 in_paint_layer_contents_(false), |
134 total_frames_used_for_lcd_text_metrics_(0), | 135 total_frames_used_for_lcd_text_metrics_(0), |
135 id_(s_layer_tree_host_sequence_number.GetNext() + 1), | 136 id_(s_layer_tree_host_sequence_number.GetNext() + 1), |
136 next_commit_forces_redraw_(false), | 137 next_commit_forces_redraw_(false), |
137 shared_bitmap_manager_(shared_bitmap_manager), | 138 shared_bitmap_manager_(shared_bitmap_manager), |
138 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), | 139 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), |
139 surface_id_namespace_(0u), | 140 surface_id_namespace_(0u), |
140 next_surface_sequence_(1u) { | 141 next_surface_sequence_(1u) { |
141 if (settings_.accelerated_animation_enabled) | 142 if (settings_.accelerated_animation_enabled) |
142 animation_registrar_ = AnimationRegistrar::Create(); | 143 animation_registrar_ = AnimationRegistrar::Create(); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 root_layer_->AddChild(hud_layer_); | 397 root_layer_->AddChild(hud_layer_); |
397 } else if (hud_layer_.get()) { | 398 } else if (hud_layer_.get()) { |
398 hud_layer_->RemoveFromParent(); | 399 hud_layer_->RemoveFromParent(); |
399 hud_layer_ = NULL; | 400 hud_layer_ = NULL; |
400 } | 401 } |
401 } | 402 } |
402 | 403 |
403 void LayerTreeHost::CommitComplete() { | 404 void LayerTreeHost::CommitComplete() { |
404 source_frame_number_++; | 405 source_frame_number_++; |
405 client_->DidCommit(); | 406 client_->DidCommit(); |
| 407 if (did_complete_scale_animation_) { |
| 408 client_->DidCompletePageScaleAnimation(); |
| 409 did_complete_scale_animation_ = false; |
| 410 } |
406 } | 411 } |
407 | 412 |
408 void LayerTreeHost::SetOutputSurface(scoped_ptr<OutputSurface> surface) { | 413 void LayerTreeHost::SetOutputSurface(scoped_ptr<OutputSurface> surface) { |
409 TRACE_EVENT0("cc", "LayerTreeHost::SetOutputSurface"); | 414 TRACE_EVENT0("cc", "LayerTreeHost::SetOutputSurface"); |
410 DCHECK(output_surface_lost_); | 415 DCHECK(output_surface_lost_); |
411 DCHECK(surface); | 416 DCHECK(surface); |
412 | 417 |
413 proxy_->SetOutputSurface(surface.Pass()); | 418 proxy_->SetOutputSurface(surface.Pass()); |
414 } | 419 } |
415 | 420 |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 | 786 |
782 DCHECK(!root_layer()->parent()); | 787 DCHECK(!root_layer()->parent()); |
783 | 788 |
784 bool result = UpdateLayers(root_layer(), queue); | 789 bool result = UpdateLayers(root_layer(), queue); |
785 | 790 |
786 micro_benchmark_controller_.DidUpdateLayers(); | 791 micro_benchmark_controller_.DidUpdateLayers(); |
787 | 792 |
788 return result || next_commit_forces_redraw_; | 793 return result || next_commit_forces_redraw_; |
789 } | 794 } |
790 | 795 |
| 796 void LayerTreeHost::DidCompletePageScaleAnimation() { |
| 797 did_complete_scale_animation_ = true; |
| 798 } |
| 799 |
791 static Layer* FindFirstScrollableLayer(Layer* layer) { | 800 static Layer* FindFirstScrollableLayer(Layer* layer) { |
792 if (!layer) | 801 if (!layer) |
793 return NULL; | 802 return NULL; |
794 | 803 |
795 if (layer->scrollable()) | 804 if (layer->scrollable()) |
796 return layer; | 805 return layer; |
797 | 806 |
798 for (size_t i = 0; i < layer->children().size(); ++i) { | 807 for (size_t i = 0; i < layer->children().size(); ++i) { |
799 Layer* found = FindFirstScrollableLayer(layer->children()[i].get()); | 808 Layer* found = FindFirstScrollableLayer(layer->children()[i].get()); |
800 if (found) | 809 if (found) |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 bool children_need_begin_frames) const { | 1396 bool children_need_begin_frames) const { |
1388 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames); | 1397 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames); |
1389 } | 1398 } |
1390 | 1399 |
1391 void LayerTreeHost::SendBeginFramesToChildren( | 1400 void LayerTreeHost::SendBeginFramesToChildren( |
1392 const BeginFrameArgs& args) const { | 1401 const BeginFrameArgs& args) const { |
1393 client_->SendBeginFramesToChildren(args); | 1402 client_->SendBeginFramesToChildren(args); |
1394 } | 1403 } |
1395 | 1404 |
1396 } // namespace cc | 1405 } // namespace cc |
OLD | NEW |