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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 void LayerTreeHost::SetNeedsRedrawRect(gfx::Rect damage_rect) { | 511 void LayerTreeHost::SetNeedsRedrawRect(gfx::Rect damage_rect) { |
512 proxy_->SetNeedsRedraw(damage_rect); | 512 proxy_->SetNeedsRedraw(damage_rect); |
513 if (!proxy_->HasImplThread()) | 513 if (!proxy_->HasImplThread()) |
514 client_->ScheduleComposite(); | 514 client_->ScheduleComposite(); |
515 } | 515 } |
516 | 516 |
517 bool LayerTreeHost::CommitRequested() const { | 517 bool LayerTreeHost::CommitRequested() const { |
518 return proxy_->CommitRequested(); | 518 return proxy_->CommitRequested(); |
519 } | 519 } |
520 | 520 |
521 void LayerTreeHost::SetNextCommitWaitsForActivation() { | |
522 proxy_->SetNextCommitWaitsForActivation(); | |
523 } | |
524 | |
525 void LayerTreeHost::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events, | 521 void LayerTreeHost::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events, |
526 base::Time wall_clock_time) { | 522 base::Time wall_clock_time) { |
527 DCHECK(proxy_->IsMainThread()); | 523 DCHECK(proxy_->IsMainThread()); |
528 for (size_t event_index = 0; event_index < events->size(); ++event_index) { | 524 for (size_t event_index = 0; event_index < events->size(); ++event_index) { |
529 int event_layer_id = (*events)[event_index].layer_id; | 525 int event_layer_id = (*events)[event_index].layer_id; |
530 | 526 |
531 // Use the map of all controllers, not just active ones, since non-active | 527 // Use the map of all controllers, not just active ones, since non-active |
532 // controllers may still receive events for impl-only animations. | 528 // controllers may still receive events for impl-only animations. |
533 const AnimationRegistrar::AnimationControllerMap& animation_controllers = | 529 const AnimationRegistrar::AnimationControllerMap& animation_controllers = |
534 animation_registrar_->all_animation_controllers(); | 530 animation_registrar_->all_animation_controllers(); |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 // Top controls are only used in threaded mode. | 1082 // Top controls are only used in threaded mode. |
1087 proxy_->ImplThreadTaskRunner()->PostTask( | 1083 proxy_->ImplThreadTaskRunner()->PostTask( |
1088 FROM_HERE, | 1084 FROM_HERE, |
1089 base::Bind(&TopControlsManager::UpdateTopControlsState, | 1085 base::Bind(&TopControlsManager::UpdateTopControlsState, |
1090 top_controls_manager_weak_ptr_, | 1086 top_controls_manager_weak_ptr_, |
1091 constraints, | 1087 constraints, |
1092 current, | 1088 current, |
1093 animate)); | 1089 animate)); |
1094 } | 1090 } |
1095 | 1091 |
| 1092 bool LayerTreeHost::BlocksPendingCommit() const { |
| 1093 if (!root_layer_.get()) |
| 1094 return false; |
| 1095 return root_layer_->BlocksPendingCommitRecursive(); |
| 1096 } |
| 1097 |
1096 scoped_ptr<base::Value> LayerTreeHost::AsValue() const { | 1098 scoped_ptr<base::Value> LayerTreeHost::AsValue() const { |
1097 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1099 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1098 state->Set("proxy", proxy_->AsValue().release()); | 1100 state->Set("proxy", proxy_->AsValue().release()); |
1099 return state.PassAs<base::Value>(); | 1101 return state.PassAs<base::Value>(); |
1100 } | 1102 } |
1101 | 1103 |
1102 void LayerTreeHost::AnimateLayers(base::TimeTicks time) { | 1104 void LayerTreeHost::AnimateLayers(base::TimeTicks time) { |
1103 rendering_stats_instrumentation_->IncrementAnimationFrameCount(); | 1105 rendering_stats_instrumentation_->IncrementAnimationFrameCount(); |
1104 if (!settings_.accelerated_animation_enabled || | 1106 if (!settings_.accelerated_animation_enabled || |
1105 animation_registrar_->active_animation_controllers().empty()) | 1107 animation_registrar_->active_animation_controllers().empty()) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 void LayerTreeHost::DidLoseUIResources() { | 1169 void LayerTreeHost::DidLoseUIResources() { |
1168 // When output surface is lost, we need to recreate the resource. | 1170 // When output surface is lost, we need to recreate the resource. |
1169 for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin(); | 1171 for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin(); |
1170 iter != ui_resource_client_map_.end(); | 1172 iter != ui_resource_client_map_.end(); |
1171 ++iter) { | 1173 ++iter) { |
1172 UIResourceLost(iter->first); | 1174 UIResourceLost(iter->first); |
1173 } | 1175 } |
1174 } | 1176 } |
1175 | 1177 |
1176 } // namespace cc | 1178 } // namespace cc |
OLD | NEW |