| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 document->view()->scheduleAnimation(); | 51 document->view()->scheduleAnimation(); |
| 52 | 52 |
| 53 bool visible = document->page() && document->page()->visibilityState() == Pa
geVisibilityStateVisible; | 53 bool visible = document->page() && document->page()->visibilityState() == Pa
geVisibilityStateVisible; |
| 54 if (!visible && !m_timer.isActive()) { | 54 if (!visible && !m_timer.isActive()) { |
| 55 m_timer.startOneShot(0, FROM_HERE); | 55 m_timer.startOneShot(0, FROM_HERE); |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool CompositorPendingAnimations::update(bool startOnCompositor) | 59 bool CompositorPendingAnimations::update(bool startOnCompositor) |
| 60 { | 60 { |
| 61 WillBeHeapVector<RawPtrWillBeMember<Animation>> waitingForStartTime; | 61 HeapVector<Member<Animation>> waitingForStartTime; |
| 62 bool startedSynchronizedOnCompositor = false; | 62 bool startedSynchronizedOnCompositor = false; |
| 63 | 63 |
| 64 WillBeHeapVector<RefPtrWillBeMember<Animation>> animations; | 64 HeapVector<Member<Animation>> animations; |
| 65 animations.swap(m_pending); | 65 animations.swap(m_pending); |
| 66 int compositorGroup = ++m_compositorGroup; | 66 int compositorGroup = ++m_compositorGroup; |
| 67 if (compositorGroup == 0) { | 67 if (compositorGroup == 0) { |
| 68 // Wrap around, skipping 0. | 68 // Wrap around, skipping 0. |
| 69 compositorGroup = ++m_compositorGroup; | 69 compositorGroup = ++m_compositorGroup; |
| 70 } | 70 } |
| 71 | 71 |
| 72 for (auto& animation : animations) { | 72 for (auto& animation : animations) { |
| 73 bool hadCompositorAnimation = animation->hasActiveAnimationsOnCompositor
(); | 73 bool hadCompositorAnimation = animation->hasActiveAnimationsOnCompositor
(); |
| 74 animation->preCommit(compositorGroup, startOnCompositor); | 74 animation->preCommit(compositorGroup, startOnCompositor); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // If not, go ahead and start any animations that were waiting. | 119 // If not, go ahead and start any animations that were waiting. |
| 120 notifyCompositorAnimationStarted(monotonicallyIncreasingTime()); | 120 notifyCompositorAnimationStarted(monotonicallyIncreasingTime()); |
| 121 | 121 |
| 122 ASSERT(m_pending.isEmpty()); | 122 ASSERT(m_pending.isEmpty()); |
| 123 return false; | 123 return false; |
| 124 } | 124 } |
| 125 | 125 |
| 126 void CompositorPendingAnimations::notifyCompositorAnimationStarted(double monoto
nicAnimationStartTime, int compositorGroup) | 126 void CompositorPendingAnimations::notifyCompositorAnimationStarted(double monoto
nicAnimationStartTime, int compositorGroup) |
| 127 { | 127 { |
| 128 TRACE_EVENT0("blink", "CompositorPendingAnimations::notifyCompositorAnimatio
nStarted"); | 128 TRACE_EVENT0("blink", "CompositorPendingAnimations::notifyCompositorAnimatio
nStarted"); |
| 129 WillBeHeapVector<RefPtrWillBeMember<Animation>> animations; | 129 HeapVector<Member<Animation>> animations; |
| 130 animations.swap(m_waitingForCompositorAnimationStart); | 130 animations.swap(m_waitingForCompositorAnimationStart); |
| 131 | 131 |
| 132 for (auto animation : animations) { | 132 for (auto animation : animations) { |
| 133 if (animation->hasStartTime() || animation->playStateInternal() != Anima
tion::Pending) { | 133 if (animation->hasStartTime() || animation->playStateInternal() != Anima
tion::Pending) { |
| 134 // Already started or no longer relevant. | 134 // Already started or no longer relevant. |
| 135 continue; | 135 continue; |
| 136 } | 136 } |
| 137 if (compositorGroup && animation->compositorGroup() != compositorGroup)
{ | 137 if (compositorGroup && animation->compositorGroup() != compositorGroup)
{ |
| 138 // Still waiting. | 138 // Still waiting. |
| 139 m_waitingForCompositorAnimationStart.append(animation); | 139 m_waitingForCompositorAnimationStart.append(animation); |
| 140 continue; | 140 continue; |
| 141 } | 141 } |
| 142 animation->notifyCompositorStartTime(monotonicAnimationStartTime - anima
tion->timeline()->zeroTime()); | 142 animation->notifyCompositorStartTime(monotonicAnimationStartTime - anima
tion->timeline()->zeroTime()); |
| 143 } | 143 } |
| 144 | 144 |
| 145 } | 145 } |
| 146 | 146 |
| 147 DEFINE_TRACE(CompositorPendingAnimations) | 147 DEFINE_TRACE(CompositorPendingAnimations) |
| 148 { | 148 { |
| 149 visitor->trace(m_pending); | 149 visitor->trace(m_pending); |
| 150 visitor->trace(m_waitingForCompositorAnimationStart); | 150 visitor->trace(m_waitingForCompositorAnimationStart); |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace | 153 } // namespace |
| OLD | NEW |