| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 } | 564 } |
| 558 | 565 |
| 559 bool LayerTreeHost::CommitRequested() const { | 566 bool LayerTreeHost::CommitRequested() const { |
| 560 return proxy_->CommitRequested(); | 567 return proxy_->CommitRequested(); |
| 561 } | 568 } |
| 562 | 569 |
| 563 void LayerTreeHost::SetNextCommitWaitsForActivation() { | 570 void LayerTreeHost::SetNextCommitWaitsForActivation() { |
| 564 proxy_->SetNextCommitWaitsForActivation(); | 571 proxy_->SetNextCommitWaitsForActivation(); |
| 565 } | 572 } |
| 566 | 573 |
| 574 void LayerTreeHost::SetNextCommitForcesRedraw() { |
| 575 next_commit_forces_redraw_ = true; |
| 576 } |
| 577 |
| 567 void LayerTreeHost::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events, | 578 void LayerTreeHost::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events, |
| 568 base::Time wall_clock_time) { | 579 base::Time wall_clock_time) { |
| 569 DCHECK(proxy_->IsMainThread()); | 580 DCHECK(proxy_->IsMainThread()); |
| 570 for (size_t event_index = 0; event_index < events->size(); ++event_index) { | 581 for (size_t event_index = 0; event_index < events->size(); ++event_index) { |
| 571 int event_layer_id = (*events)[event_index].layer_id; | 582 int event_layer_id = (*events)[event_index].layer_id; |
| 572 | 583 |
| 573 // Use the map of all controllers, not just active ones, since non-active | 584 // Use the map of all controllers, not just active ones, since non-active |
| 574 // controllers may still receive events for impl-only animations. | 585 // controllers may still receive events for impl-only animations. |
| 575 const AnimationRegistrar::AnimationControllerMap& animation_controllers = | 586 const AnimationRegistrar::AnimationControllerMap& animation_controllers = |
| 576 animation_registrar_->all_animation_controllers(); | 587 animation_registrar_->all_animation_controllers(); |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 void LayerTreeHost::RegisterViewportLayers( | 1247 void LayerTreeHost::RegisterViewportLayers( |
| 1237 scoped_refptr<Layer> page_scale_layer, | 1248 scoped_refptr<Layer> page_scale_layer, |
| 1238 scoped_refptr<Layer> inner_viewport_scroll_layer, | 1249 scoped_refptr<Layer> inner_viewport_scroll_layer, |
| 1239 scoped_refptr<Layer> outer_viewport_scroll_layer) { | 1250 scoped_refptr<Layer> outer_viewport_scroll_layer) { |
| 1240 page_scale_layer_ = page_scale_layer; | 1251 page_scale_layer_ = page_scale_layer; |
| 1241 inner_viewport_scroll_layer_ = inner_viewport_scroll_layer; | 1252 inner_viewport_scroll_layer_ = inner_viewport_scroll_layer; |
| 1242 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer; | 1253 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer; |
| 1243 } | 1254 } |
| 1244 | 1255 |
| 1245 } // namespace cc | 1256 } // namespace cc |
| OLD | NEW |