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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 background_color_(SK_ColorWHITE), | 129 background_color_(SK_ColorWHITE), |
130 has_transparent_background_(false), | 130 has_transparent_background_(false), |
131 partial_texture_update_requests_(0), | 131 partial_texture_update_requests_(0), |
132 in_paint_layer_contents_(false), | 132 in_paint_layer_contents_(false), |
133 total_frames_used_for_lcd_text_metrics_(0), | 133 total_frames_used_for_lcd_text_metrics_(0), |
134 id_(s_layer_tree_host_sequence_number.GetNext() + 1), | 134 id_(s_layer_tree_host_sequence_number.GetNext() + 1), |
135 next_commit_forces_redraw_(false), | 135 next_commit_forces_redraw_(false), |
136 shared_bitmap_manager_(shared_bitmap_manager), | 136 shared_bitmap_manager_(shared_bitmap_manager), |
137 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), | 137 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), |
138 surface_id_namespace_(0u), | 138 surface_id_namespace_(0u), |
139 next_surface_sequence_(1u) { | 139 next_surface_sequence_(1u), |
| 140 did_complete_scale_animation_before_commit_(false) { |
140 if (settings_.accelerated_animation_enabled) | 141 if (settings_.accelerated_animation_enabled) |
141 animation_registrar_ = AnimationRegistrar::Create(); | 142 animation_registrar_ = AnimationRegistrar::Create(); |
142 rendering_stats_instrumentation_->set_record_rendering_stats( | 143 rendering_stats_instrumentation_->set_record_rendering_stats( |
143 debug_state_.RecordRenderingStats()); | 144 debug_state_.RecordRenderingStats()); |
144 } | 145 } |
145 | 146 |
146 void LayerTreeHost::InitializeThreaded( | 147 void LayerTreeHost::InitializeThreaded( |
147 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 148 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
148 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 149 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
149 scoped_ptr<BeginFrameSource> external_begin_frame_source) { | 150 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 root_layer_->AddChild(hud_layer_); | 425 root_layer_->AddChild(hud_layer_); |
425 } else if (hud_layer_.get()) { | 426 } else if (hud_layer_.get()) { |
426 hud_layer_->RemoveFromParent(); | 427 hud_layer_->RemoveFromParent(); |
427 hud_layer_ = NULL; | 428 hud_layer_ = NULL; |
428 } | 429 } |
429 } | 430 } |
430 | 431 |
431 void LayerTreeHost::CommitComplete() { | 432 void LayerTreeHost::CommitComplete() { |
432 source_frame_number_++; | 433 source_frame_number_++; |
433 client_->DidCommit(); | 434 client_->DidCommit(); |
| 435 if (did_complete_scale_animation_before_commit_) { |
| 436 client_->DidCompletePageScaleAnimation(); |
| 437 did_complete_scale_animation_before_commit_ = false; |
| 438 } |
434 } | 439 } |
435 | 440 |
436 void LayerTreeHost::SetOutputSurface(scoped_ptr<OutputSurface> surface) { | 441 void LayerTreeHost::SetOutputSurface(scoped_ptr<OutputSurface> surface) { |
437 proxy_->SetOutputSurface(surface.Pass()); | 442 proxy_->SetOutputSurface(surface.Pass()); |
438 } | 443 } |
439 | 444 |
440 void LayerTreeHost::RequestNewOutputSurface() { | 445 void LayerTreeHost::RequestNewOutputSurface() { |
441 client_->RequestNewOutputSurface(num_failed_recreate_attempts_ >= 4); | 446 client_->RequestNewOutputSurface(num_failed_recreate_attempts_ >= 4); |
442 } | 447 } |
443 | 448 |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 | 760 |
756 DCHECK(!root_layer()->parent()); | 761 DCHECK(!root_layer()->parent()); |
757 | 762 |
758 bool result = UpdateLayers(root_layer(), queue); | 763 bool result = UpdateLayers(root_layer(), queue); |
759 | 764 |
760 micro_benchmark_controller_.DidUpdateLayers(); | 765 micro_benchmark_controller_.DidUpdateLayers(); |
761 | 766 |
762 return result || next_commit_forces_redraw_; | 767 return result || next_commit_forces_redraw_; |
763 } | 768 } |
764 | 769 |
| 770 void LayerTreeHost::DidCompletePageScaleAnimationBeforeCommit() { |
| 771 did_complete_scale_animation_before_commit_ = true; |
| 772 } |
| 773 |
765 static Layer* FindFirstScrollableLayer(Layer* layer) { | 774 static Layer* FindFirstScrollableLayer(Layer* layer) { |
766 if (!layer) | 775 if (!layer) |
767 return NULL; | 776 return NULL; |
768 | 777 |
769 if (layer->scrollable()) | 778 if (layer->scrollable()) |
770 return layer; | 779 return layer; |
771 | 780 |
772 for (size_t i = 0; i < layer->children().size(); ++i) { | 781 for (size_t i = 0; i < layer->children().size(); ++i) { |
773 Layer* found = FindFirstScrollableLayer(layer->children()[i].get()); | 782 Layer* found = FindFirstScrollableLayer(layer->children()[i].get()); |
774 if (found) | 783 if (found) |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 | 1355 |
1347 void LayerTreeHost::set_surface_id_namespace(uint32_t id_namespace) { | 1356 void LayerTreeHost::set_surface_id_namespace(uint32_t id_namespace) { |
1348 surface_id_namespace_ = id_namespace; | 1357 surface_id_namespace_ = id_namespace; |
1349 } | 1358 } |
1350 | 1359 |
1351 SurfaceSequence LayerTreeHost::CreateSurfaceSequence() { | 1360 SurfaceSequence LayerTreeHost::CreateSurfaceSequence() { |
1352 return SurfaceSequence(surface_id_namespace_, next_surface_sequence_++); | 1361 return SurfaceSequence(surface_id_namespace_, next_surface_sequence_++); |
1353 } | 1362 } |
1354 | 1363 |
1355 } // namespace cc | 1364 } // namespace cc |
OLD | NEW |