| 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 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 visible_(true), | 125 visible_(true), |
| 126 page_scale_factor_(1.f), | 126 page_scale_factor_(1.f), |
| 127 min_page_scale_factor_(1.f), | 127 min_page_scale_factor_(1.f), |
| 128 max_page_scale_factor_(1.f), | 128 max_page_scale_factor_(1.f), |
| 129 trigger_idle_updates_(true), | 129 trigger_idle_updates_(true), |
| 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 in_paint_layer_contents_(false), | 133 in_paint_layer_contents_(false), |
| 134 total_frames_used_for_lcd_text_metrics_(0), | 134 total_frames_used_for_lcd_text_metrics_(0), |
| 135 tree_id_(s_next_tree_id++) { | 135 tree_id_(s_next_tree_id++), |
| 136 next_commit_forces_redraw_(false) { |
| 136 if (settings_.accelerated_animation_enabled) | 137 if (settings_.accelerated_animation_enabled) |
| 137 animation_registrar_ = AnimationRegistrar::Create(); | 138 animation_registrar_ = AnimationRegistrar::Create(); |
| 138 s_num_layer_tree_instances++; | 139 s_num_layer_tree_instances++; |
| 139 rendering_stats_instrumentation_->set_record_rendering_stats( | 140 rendering_stats_instrumentation_->set_record_rendering_stats( |
| 140 debug_state_.RecordRenderingStats()); | 141 debug_state_.RecordRenderingStats()); |
| 141 } | 142 } |
| 142 | 143 |
| 143 bool LayerTreeHost::Initialize( | 144 bool LayerTreeHost::Initialize( |
| 144 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { | 145 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { |
| 145 if (impl_task_runner.get()) | 146 if (impl_task_runner.get()) |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // In impl-side painting, synchronize to the pending tree so that it has | 316 // In impl-side painting, synchronize to the pending tree so that it has |
| 316 // time to raster before being displayed. If no pending tree is needed, | 317 // time to raster before being displayed. If no pending tree is needed, |
| 317 // synchronization can happen directly to the active tree and | 318 // synchronization can happen directly to the active tree and |
| 318 // unlinked contents resources can be reclaimed immediately. | 319 // unlinked contents resources can be reclaimed immediately. |
| 319 LayerTreeImpl* sync_tree; | 320 LayerTreeImpl* sync_tree; |
| 320 if (settings_.impl_side_painting) { | 321 if (settings_.impl_side_painting) { |
| 321 // Commits should not occur while there is already a pending tree. | 322 // Commits should not occur while there is already a pending tree. |
| 322 DCHECK(!host_impl->pending_tree()); | 323 DCHECK(!host_impl->pending_tree()); |
| 323 host_impl->CreatePendingTree(); | 324 host_impl->CreatePendingTree(); |
| 324 sync_tree = host_impl->pending_tree(); | 325 sync_tree = host_impl->pending_tree(); |
| 326 if (next_commit_forces_redraw_) |
| 327 sync_tree->ForceRedrawNextActivation(); |
| 325 } else { | 328 } else { |
| 329 if (next_commit_forces_redraw_) |
| 330 host_impl->SetFullRootLayerDamage(); |
| 326 contents_texture_manager_->ReduceMemory(host_impl->resource_provider()); | 331 contents_texture_manager_->ReduceMemory(host_impl->resource_provider()); |
| 327 sync_tree = host_impl->active_tree(); | 332 sync_tree = host_impl->active_tree(); |
| 328 } | 333 } |
| 329 | 334 |
| 335 next_commit_forces_redraw_ = false; |
| 336 |
| 330 sync_tree->set_source_frame_number(source_frame_number()); | 337 sync_tree->set_source_frame_number(source_frame_number()); |
| 331 | 338 |
| 332 if (needs_full_tree_sync_) | 339 if (needs_full_tree_sync_) |
| 333 sync_tree->SetRootLayer(TreeSynchronizer::SynchronizeTrees( | 340 sync_tree->SetRootLayer(TreeSynchronizer::SynchronizeTrees( |
| 334 root_layer(), sync_tree->DetachLayerTree(), sync_tree)); | 341 root_layer(), sync_tree->DetachLayerTree(), sync_tree)); |
| 335 { | 342 { |
| 336 TRACE_EVENT0("cc", "LayerTreeHost::PushProperties"); | 343 TRACE_EVENT0("cc", "LayerTreeHost::PushProperties"); |
| 337 TreeSynchronizer::PushProperties(root_layer(), sync_tree->root_layer()); | 344 TreeSynchronizer::PushProperties(root_layer(), sync_tree->root_layer()); |
| 338 } | 345 } |
| 339 | 346 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 } | 565 } |
| 559 | 566 |
| 560 bool LayerTreeHost::CommitRequested() const { | 567 bool LayerTreeHost::CommitRequested() const { |
| 561 return proxy_->CommitRequested(); | 568 return proxy_->CommitRequested(); |
| 562 } | 569 } |
| 563 | 570 |
| 564 void LayerTreeHost::SetNextCommitWaitsForActivation() { | 571 void LayerTreeHost::SetNextCommitWaitsForActivation() { |
| 565 proxy_->SetNextCommitWaitsForActivation(); | 572 proxy_->SetNextCommitWaitsForActivation(); |
| 566 } | 573 } |
| 567 | 574 |
| 575 void LayerTreeHost::SetNextCommitForcesRedraw() { |
| 576 next_commit_forces_redraw_ = true; |
| 577 } |
| 578 |
| 568 void LayerTreeHost::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events, | 579 void LayerTreeHost::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events, |
| 569 base::Time wall_clock_time) { | 580 base::Time wall_clock_time) { |
| 570 DCHECK(proxy_->IsMainThread()); | 581 DCHECK(proxy_->IsMainThread()); |
| 571 for (size_t event_index = 0; event_index < events->size(); ++event_index) { | 582 for (size_t event_index = 0; event_index < events->size(); ++event_index) { |
| 572 int event_layer_id = (*events)[event_index].layer_id; | 583 int event_layer_id = (*events)[event_index].layer_id; |
| 573 | 584 |
| 574 // Use the map of all controllers, not just active ones, since non-active | 585 // Use the map of all controllers, not just active ones, since non-active |
| 575 // controllers may still receive events for impl-only animations. | 586 // controllers may still receive events for impl-only animations. |
| 576 const AnimationRegistrar::AnimationControllerMap& animation_controllers = | 587 const AnimationRegistrar::AnimationControllerMap& animation_controllers = |
| 577 animation_registrar_->all_animation_controllers(); | 588 animation_registrar_->all_animation_controllers(); |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 void LayerTreeHost::RegisterViewportLayers( | 1246 void LayerTreeHost::RegisterViewportLayers( |
| 1236 scoped_refptr<Layer> page_scale_layer, | 1247 scoped_refptr<Layer> page_scale_layer, |
| 1237 scoped_refptr<Layer> inner_viewport_scroll_layer, | 1248 scoped_refptr<Layer> inner_viewport_scroll_layer, |
| 1238 scoped_refptr<Layer> outer_viewport_scroll_layer) { | 1249 scoped_refptr<Layer> outer_viewport_scroll_layer) { |
| 1239 page_scale_layer_ = page_scale_layer; | 1250 page_scale_layer_ = page_scale_layer; |
| 1240 inner_viewport_scroll_layer_ = inner_viewport_scroll_layer; | 1251 inner_viewport_scroll_layer_ = inner_viewport_scroll_layer; |
| 1241 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer; | 1252 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer; |
| 1242 } | 1253 } |
| 1243 | 1254 |
| 1244 } // namespace cc | 1255 } // namespace cc |
| OLD | NEW |