OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 DCHECK(m_animationsNeedingUpdate.contains(animation)); | 103 DCHECK(m_animationsNeedingUpdate.contains(animation)); |
104 | 104 |
105 return animation; | 105 return animation; |
106 } | 106 } |
107 | 107 |
108 HeapVector<Member<Animation>> AnimationTimeline::getAnimations() { | 108 HeapVector<Member<Animation>> AnimationTimeline::getAnimations() { |
109 HeapVector<Member<Animation>> animations; | 109 HeapVector<Member<Animation>> animations; |
110 for (const auto& animation : m_animations) { | 110 for (const auto& animation : m_animations) { |
111 if (animation->effect() && | 111 if (animation->effect() && |
112 (animation->effect()->isCurrent() || animation->effect()->isInEffect())) | 112 (animation->effect()->isCurrent() || animation->effect()->isInEffect())) |
113 animations.append(animation); | 113 animations.push_back(animation); |
114 } | 114 } |
115 std::sort(animations.begin(), animations.end(), compareAnimations); | 115 std::sort(animations.begin(), animations.end(), compareAnimations); |
116 return animations; | 116 return animations; |
117 } | 117 } |
118 | 118 |
119 void AnimationTimeline::wake() { | 119 void AnimationTimeline::wake() { |
120 m_timing->serviceOnNextFrame(); | 120 m_timing->serviceOnNextFrame(); |
121 } | 121 } |
122 | 122 |
123 void AnimationTimeline::serviceAnimations(TimingUpdateReason reason) { | 123 void AnimationTimeline::serviceAnimations(TimingUpdateReason reason) { |
124 TRACE_EVENT0("blink", "AnimationTimeline::serviceAnimations"); | 124 TRACE_EVENT0("blink", "AnimationTimeline::serviceAnimations"); |
125 | 125 |
126 m_lastCurrentTimeInternal = currentTimeInternal(); | 126 m_lastCurrentTimeInternal = currentTimeInternal(); |
127 | 127 |
128 HeapVector<Member<Animation>> animations; | 128 HeapVector<Member<Animation>> animations; |
129 animations.reserveInitialCapacity(m_animationsNeedingUpdate.size()); | 129 animations.reserveInitialCapacity(m_animationsNeedingUpdate.size()); |
130 for (Animation* animation : m_animationsNeedingUpdate) | 130 for (Animation* animation : m_animationsNeedingUpdate) |
131 animations.append(animation); | 131 animations.push_back(animation); |
132 | 132 |
133 std::sort(animations.begin(), animations.end(), Animation::hasLowerPriority); | 133 std::sort(animations.begin(), animations.end(), Animation::hasLowerPriority); |
134 | 134 |
135 for (Animation* animation : animations) { | 135 for (Animation* animation : animations) { |
136 if (!animation->update(reason)) | 136 if (!animation->update(reason)) |
137 m_animationsNeedingUpdate.remove(animation); | 137 m_animationsNeedingUpdate.remove(animation); |
138 } | 138 } |
139 | 139 |
140 DCHECK_EQ(m_outdatedAnimationCount, 0U); | 140 DCHECK_EQ(m_outdatedAnimationCount, 0U); |
141 DCHECK(m_lastCurrentTimeInternal == currentTimeInternal() || | 141 DCHECK(m_lastCurrentTimeInternal == currentTimeInternal() || |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 } | 317 } |
318 | 318 |
319 DEFINE_TRACE(AnimationTimeline) { | 319 DEFINE_TRACE(AnimationTimeline) { |
320 visitor->trace(m_document); | 320 visitor->trace(m_document); |
321 visitor->trace(m_timing); | 321 visitor->trace(m_timing); |
322 visitor->trace(m_animationsNeedingUpdate); | 322 visitor->trace(m_animationsNeedingUpdate); |
323 visitor->trace(m_animations); | 323 visitor->trace(m_animations); |
324 } | 324 } |
325 | 325 |
326 } // namespace blink | 326 } // namespace blink |
OLD | NEW |