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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 | 782 |
778 DCHECK(!root_layer()->parent()); | 783 DCHECK(!root_layer()->parent()); |
779 | 784 |
780 bool result = UpdateLayers(root_layer(), queue); | 785 bool result = UpdateLayers(root_layer(), queue); |
781 | 786 |
782 micro_benchmark_controller_.DidUpdateLayers(); | 787 micro_benchmark_controller_.DidUpdateLayers(); |
783 | 788 |
784 return result || next_commit_forces_redraw_; | 789 return result || next_commit_forces_redraw_; |
785 } | 790 } |
786 | 791 |
| 792 void LayerTreeHost::DidCompletePageScaleAnimation() { |
| 793 did_complete_scale_animation_ = true; |
| 794 } |
| 795 |
787 static Layer* FindFirstScrollableLayer(Layer* layer) { | 796 static Layer* FindFirstScrollableLayer(Layer* layer) { |
788 if (!layer) | 797 if (!layer) |
789 return NULL; | 798 return NULL; |
790 | 799 |
791 if (layer->scrollable()) | 800 if (layer->scrollable()) |
792 return layer; | 801 return layer; |
793 | 802 |
794 for (size_t i = 0; i < layer->children().size(); ++i) { | 803 for (size_t i = 0; i < layer->children().size(); ++i) { |
795 Layer* found = FindFirstScrollableLayer(layer->children()[i].get()); | 804 Layer* found = FindFirstScrollableLayer(layer->children()[i].get()); |
796 if (found) | 805 if (found) |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 bool children_need_begin_frames) const { | 1391 bool children_need_begin_frames) const { |
1383 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames); | 1392 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames); |
1384 } | 1393 } |
1385 | 1394 |
1386 void LayerTreeHost::SendBeginFramesToChildren( | 1395 void LayerTreeHost::SendBeginFramesToChildren( |
1387 const BeginFrameArgs& args) const { | 1396 const BeginFrameArgs& args) const { |
1388 client_->SendBeginFramesToChildren(args); | 1397 client_->SendBeginFramesToChildren(args); |
1389 } | 1398 } |
1390 | 1399 |
1391 } // namespace cc | 1400 } // namespace cc |
OLD | NEW |