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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 visible_(true), | 102 visible_(true), |
103 page_scale_factor_(1.f), | 103 page_scale_factor_(1.f), |
104 min_page_scale_factor_(1.f), | 104 min_page_scale_factor_(1.f), |
105 max_page_scale_factor_(1.f), | 105 max_page_scale_factor_(1.f), |
106 trigger_idle_updates_(true), | 106 trigger_idle_updates_(true), |
107 background_color_(SK_ColorWHITE), | 107 background_color_(SK_ColorWHITE), |
108 has_transparent_background_(false), | 108 has_transparent_background_(false), |
109 partial_texture_update_requests_(0), | 109 partial_texture_update_requests_(0), |
110 in_paint_layer_contents_(false), | 110 in_paint_layer_contents_(false), |
111 total_frames_used_for_lcd_text_metrics_(0), | 111 total_frames_used_for_lcd_text_metrics_(0), |
112 tree_id_(s_next_tree_id++) { | 112 tree_id_(s_next_tree_id++), |
| 113 next_commit_forces_redraw_(false) { |
113 if (settings_.accelerated_animation_enabled) | 114 if (settings_.accelerated_animation_enabled) |
114 animation_registrar_ = AnimationRegistrar::Create(); | 115 animation_registrar_ = AnimationRegistrar::Create(); |
115 s_num_layer_tree_instances++; | 116 s_num_layer_tree_instances++; |
116 rendering_stats_instrumentation_->set_record_rendering_stats( | 117 rendering_stats_instrumentation_->set_record_rendering_stats( |
117 debug_state_.RecordRenderingStats()); | 118 debug_state_.RecordRenderingStats()); |
118 } | 119 } |
119 | 120 |
120 bool LayerTreeHost::Initialize( | 121 bool LayerTreeHost::Initialize( |
121 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { | 122 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { |
122 if (impl_task_runner.get()) | 123 if (impl_task_runner.get()) |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 // In impl-side painting, synchronize to the pending tree so that it has | 293 // In impl-side painting, synchronize to the pending tree so that it has |
293 // time to raster before being displayed. If no pending tree is needed, | 294 // time to raster before being displayed. If no pending tree is needed, |
294 // synchronization can happen directly to the active tree and | 295 // synchronization can happen directly to the active tree and |
295 // unlinked contents resources can be reclaimed immediately. | 296 // unlinked contents resources can be reclaimed immediately. |
296 LayerTreeImpl* sync_tree; | 297 LayerTreeImpl* sync_tree; |
297 if (settings_.impl_side_painting) { | 298 if (settings_.impl_side_painting) { |
298 // Commits should not occur while there is already a pending tree. | 299 // Commits should not occur while there is already a pending tree. |
299 DCHECK(!host_impl->pending_tree()); | 300 DCHECK(!host_impl->pending_tree()); |
300 host_impl->CreatePendingTree(); | 301 host_impl->CreatePendingTree(); |
301 sync_tree = host_impl->pending_tree(); | 302 sync_tree = host_impl->pending_tree(); |
| 303 if (next_commit_forces_redraw_) |
| 304 sync_tree->ForceRedrawNextActivation(); |
302 } else { | 305 } else { |
| 306 if (next_commit_forces_redraw_) |
| 307 host_impl->SetFullRootLayerDamage(); |
303 contents_texture_manager_->ReduceMemory(host_impl->resource_provider()); | 308 contents_texture_manager_->ReduceMemory(host_impl->resource_provider()); |
304 sync_tree = host_impl->active_tree(); | 309 sync_tree = host_impl->active_tree(); |
305 } | 310 } |
306 | 311 |
| 312 next_commit_forces_redraw_ = false; |
| 313 |
307 sync_tree->set_source_frame_number(source_frame_number()); | 314 sync_tree->set_source_frame_number(source_frame_number()); |
308 | 315 |
309 if (needs_full_tree_sync_) | 316 if (needs_full_tree_sync_) |
310 sync_tree->SetRootLayer(TreeSynchronizer::SynchronizeTrees( | 317 sync_tree->SetRootLayer(TreeSynchronizer::SynchronizeTrees( |
311 root_layer(), sync_tree->DetachLayerTree(), sync_tree)); | 318 root_layer(), sync_tree->DetachLayerTree(), sync_tree)); |
312 { | 319 { |
313 TRACE_EVENT0("cc", "LayerTreeHost::PushProperties"); | 320 TRACE_EVENT0("cc", "LayerTreeHost::PushProperties"); |
314 TreeSynchronizer::PushProperties(root_layer(), sync_tree->root_layer()); | 321 TreeSynchronizer::PushProperties(root_layer(), sync_tree->root_layer()); |
315 } | 322 } |
316 | 323 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 } | 542 } |
536 | 543 |
537 bool LayerTreeHost::CommitRequested() const { | 544 bool LayerTreeHost::CommitRequested() const { |
538 return proxy_->CommitRequested(); | 545 return proxy_->CommitRequested(); |
539 } | 546 } |
540 | 547 |
541 void LayerTreeHost::SetNextCommitWaitsForActivation() { | 548 void LayerTreeHost::SetNextCommitWaitsForActivation() { |
542 proxy_->SetNextCommitWaitsForActivation(); | 549 proxy_->SetNextCommitWaitsForActivation(); |
543 } | 550 } |
544 | 551 |
| 552 void LayerTreeHost::SetNextCommitForcesRedraw() { |
| 553 next_commit_forces_redraw_ = true; |
| 554 } |
| 555 |
545 void LayerTreeHost::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events, | 556 void LayerTreeHost::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events, |
546 base::Time wall_clock_time) { | 557 base::Time wall_clock_time) { |
547 DCHECK(proxy_->IsMainThread()); | 558 DCHECK(proxy_->IsMainThread()); |
548 for (size_t event_index = 0; event_index < events->size(); ++event_index) { | 559 for (size_t event_index = 0; event_index < events->size(); ++event_index) { |
549 int event_layer_id = (*events)[event_index].layer_id; | 560 int event_layer_id = (*events)[event_index].layer_id; |
550 | 561 |
551 // Use the map of all controllers, not just active ones, since non-active | 562 // Use the map of all controllers, not just active ones, since non-active |
552 // controllers may still receive events for impl-only animations. | 563 // controllers may still receive events for impl-only animations. |
553 const AnimationRegistrar::AnimationControllerMap& animation_controllers = | 564 const AnimationRegistrar::AnimationControllerMap& animation_controllers = |
554 animation_registrar_->all_animation_controllers(); | 565 animation_registrar_->all_animation_controllers(); |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 void LayerTreeHost::RegisterViewportLayers( | 1218 void LayerTreeHost::RegisterViewportLayers( |
1208 scoped_refptr<Layer> page_scale_layer, | 1219 scoped_refptr<Layer> page_scale_layer, |
1209 scoped_refptr<Layer> inner_viewport_scroll_layer, | 1220 scoped_refptr<Layer> inner_viewport_scroll_layer, |
1210 scoped_refptr<Layer> outer_viewport_scroll_layer) { | 1221 scoped_refptr<Layer> outer_viewport_scroll_layer) { |
1211 page_scale_layer_ = page_scale_layer; | 1222 page_scale_layer_ = page_scale_layer; |
1212 inner_viewport_scroll_layer_ = inner_viewport_scroll_layer; | 1223 inner_viewport_scroll_layer_ = inner_viewport_scroll_layer; |
1213 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer; | 1224 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer; |
1214 } | 1225 } |
1215 | 1226 |
1216 } // namespace cc | 1227 } // namespace cc |
OLD | NEW |