OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/animation/animation_registrar.h" | 5 #include "cc/animation/animation_registrar.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
| 9 #include "base/memory/ptr_util.h" |
9 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
10 #include "base/trace_event/trace_event_argument.h" | 11 #include "base/trace_event/trace_event_argument.h" |
11 #include "cc/animation/animation_events.h" | 12 #include "cc/animation/animation_events.h" |
12 #include "cc/animation/layer_animation_controller.h" | 13 #include "cc/animation/layer_animation_controller.h" |
13 | 14 |
14 namespace cc { | 15 namespace cc { |
15 | 16 |
16 AnimationRegistrar::AnimationRegistrar() : supports_scroll_animations_(false) { | 17 AnimationRegistrar::AnimationRegistrar() : supports_scroll_animations_(false) { |
17 } | 18 } |
18 | 19 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 93 |
93 TRACE_EVENT0("cc", "AnimationRegistrar::UpdateAnimationState"); | 94 TRACE_EVENT0("cc", "AnimationRegistrar::UpdateAnimationState"); |
94 AnimationControllerMap active_controllers_copy = | 95 AnimationControllerMap active_controllers_copy = |
95 active_animation_controllers_; | 96 active_animation_controllers_; |
96 for (auto& it : active_controllers_copy) | 97 for (auto& it : active_controllers_copy) |
97 it.second->UpdateState(start_ready_animations, events); | 98 it.second->UpdateState(start_ready_animations, events); |
98 | 99 |
99 return true; | 100 return true; |
100 } | 101 } |
101 | 102 |
102 scoped_ptr<AnimationEvents> AnimationRegistrar::CreateEvents() { | 103 std::unique_ptr<AnimationEvents> AnimationRegistrar::CreateEvents() { |
103 return make_scoped_ptr(new AnimationEvents()); | 104 return base::WrapUnique(new AnimationEvents()); |
104 } | 105 } |
105 | 106 |
106 void AnimationRegistrar::SetAnimationEvents( | 107 void AnimationRegistrar::SetAnimationEvents( |
107 scoped_ptr<AnimationEvents> events) { | 108 std::unique_ptr<AnimationEvents> events) { |
108 for (size_t event_index = 0; event_index < events->events_.size(); | 109 for (size_t event_index = 0; event_index < events->events_.size(); |
109 ++event_index) { | 110 ++event_index) { |
110 int event_layer_id = events->events_[event_index].layer_id; | 111 int event_layer_id = events->events_[event_index].layer_id; |
111 | 112 |
112 // Use the map of all controllers, not just active ones, since non-active | 113 // Use the map of all controllers, not just active ones, since non-active |
113 // controllers may still receive events for impl-only animations. | 114 // controllers may still receive events for impl-only animations. |
114 const AnimationRegistrar::AnimationControllerMap& animation_controllers = | 115 const AnimationRegistrar::AnimationControllerMap& animation_controllers = |
115 all_animation_controllers_; | 116 all_animation_controllers_; |
116 auto iter = animation_controllers.find(event_layer_id); | 117 auto iter = animation_controllers.find(event_layer_id); |
117 if (iter != animation_controllers.end()) { | 118 if (iter != animation_controllers.end()) { |
(...skipping 17 matching lines...) Expand all Loading... |
135 | 136 |
136 case AnimationEvent::TAKEOVER: | 137 case AnimationEvent::TAKEOVER: |
137 (*iter).second->NotifyAnimationTakeover(events->events_[event_index]); | 138 (*iter).second->NotifyAnimationTakeover(events->events_[event_index]); |
138 break; | 139 break; |
139 } | 140 } |
140 } | 141 } |
141 } | 142 } |
142 } | 143 } |
143 | 144 |
144 } // namespace cc | 145 } // namespace cc |
OLD | NEW |