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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 void LayerTreeHost::SetAnimationEvents( | 551 void LayerTreeHost::SetAnimationEvents( |
552 scoped_ptr<AnimationEventsVector> events) { | 552 scoped_ptr<AnimationEventsVector> events) { |
553 DCHECK(proxy_->IsMainThread()); | 553 DCHECK(proxy_->IsMainThread()); |
554 for (size_t event_index = 0; event_index < events->size(); ++event_index) { | 554 for (size_t event_index = 0; event_index < events->size(); ++event_index) { |
555 int event_layer_id = (*events)[event_index].layer_id; | 555 int event_layer_id = (*events)[event_index].layer_id; |
556 | 556 |
557 // Use the map of all controllers, not just active ones, since non-active | 557 // Use the map of all controllers, not just active ones, since non-active |
558 // controllers may still receive events for impl-only animations. | 558 // controllers may still receive events for impl-only animations. |
559 const AnimationRegistrar::AnimationControllerMap& animation_controllers = | 559 const AnimationRegistrar::AnimationControllerMap& animation_controllers = |
560 animation_registrar_->all_animation_controllers(); | 560 animation_registrar_->all_animation_controllers(); |
561 AnimationRegistrar::AnimationControllerMap::const_iterator iter = | 561 auto iter = animation_controllers.find(event_layer_id); |
562 animation_controllers.find(event_layer_id); | |
563 if (iter != animation_controllers.end()) { | 562 if (iter != animation_controllers.end()) { |
564 switch ((*events)[event_index].type) { | 563 switch ((*events)[event_index].type) { |
565 case AnimationEvent::STARTED: | 564 case AnimationEvent::STARTED: |
566 (*iter).second->NotifyAnimationStarted((*events)[event_index]); | 565 (*iter).second->NotifyAnimationStarted((*events)[event_index]); |
567 break; | 566 break; |
568 | 567 |
569 case AnimationEvent::FINISHED: | 568 case AnimationEvent::FINISHED: |
570 (*iter).second->NotifyAnimationFinished((*events)[event_index]); | 569 (*iter).second->NotifyAnimationFinished((*events)[event_index]); |
571 break; | 570 break; |
572 | 571 |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 state->EndDictionary(); | 1186 state->EndDictionary(); |
1188 } | 1187 } |
1189 | 1188 |
1190 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) { | 1189 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) { |
1191 if (!settings_.accelerated_animation_enabled || | 1190 if (!settings_.accelerated_animation_enabled || |
1192 animation_registrar_->active_animation_controllers().empty()) | 1191 animation_registrar_->active_animation_controllers().empty()) |
1193 return; | 1192 return; |
1194 | 1193 |
1195 TRACE_EVENT0("cc", "LayerTreeHost::AnimateLayers"); | 1194 TRACE_EVENT0("cc", "LayerTreeHost::AnimateLayers"); |
1196 | 1195 |
1197 AnimationRegistrar::AnimationControllerMap copy = | 1196 AnimationRegistrar::AnimationControllerMap active_controllers_copy = |
1198 animation_registrar_->active_animation_controllers(); | 1197 animation_registrar_->active_animation_controllers(); |
1199 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); | 1198 for (auto& it : active_controllers_copy) { |
1200 iter != copy.end(); | 1199 it.second->Animate(monotonic_time); |
1201 ++iter) { | |
1202 (*iter).second->Animate(monotonic_time); | |
1203 bool start_ready_animations = true; | 1200 bool start_ready_animations = true; |
1204 (*iter).second->UpdateState(start_ready_animations, NULL); | 1201 it.second->UpdateState(start_ready_animations, NULL); |
1205 } | 1202 } |
1206 } | 1203 } |
1207 | 1204 |
1208 UIResourceId LayerTreeHost::CreateUIResource(UIResourceClient* client) { | 1205 UIResourceId LayerTreeHost::CreateUIResource(UIResourceClient* client) { |
1209 DCHECK(client); | 1206 DCHECK(client); |
1210 | 1207 |
1211 UIResourceId next_id = next_ui_resource_id_++; | 1208 UIResourceId next_id = next_ui_resource_id_++; |
1212 DCHECK(ui_resource_client_map_.find(next_id) == | 1209 DCHECK(ui_resource_client_map_.find(next_id) == |
1213 ui_resource_client_map_.end()); | 1210 ui_resource_client_map_.end()); |
1214 | 1211 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 bool children_need_begin_frames) const { | 1327 bool children_need_begin_frames) const { |
1331 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames); | 1328 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames); |
1332 } | 1329 } |
1333 | 1330 |
1334 void LayerTreeHost::SendBeginFramesToChildren( | 1331 void LayerTreeHost::SendBeginFramesToChildren( |
1335 const BeginFrameArgs& args) const { | 1332 const BeginFrameArgs& args) const { |
1336 client_->SendBeginFramesToChildren(args); | 1333 client_->SendBeginFramesToChildren(args); |
1337 } | 1334 } |
1338 | 1335 |
1339 } // namespace cc | 1336 } // namespace cc |
OLD | NEW |