| 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 namespace { | 51 namespace { |
| 52 | 52 |
| 53 static unsigned nextSequenceNumber() | 53 static unsigned nextSequenceNumber() |
| 54 { | 54 { |
| 55 static unsigned next = 0; | 55 static unsigned next = 0; |
| 56 return ++next; | 56 return ++next; |
| 57 } | 57 } |
| 58 | 58 |
| 59 } | 59 } |
| 60 | 60 |
| 61 PassRefPtrWillBeRawPtr<Animation> Animation::create(AnimationEffect* effect, Ani
mationTimeline* timeline) | 61 Animation* Animation::create(AnimationEffect* effect, AnimationTimeline* timelin
e) |
| 62 { | 62 { |
| 63 if (!timeline) { | 63 if (!timeline) { |
| 64 // FIXME: Support creating animations without a timeline. | 64 // FIXME: Support creating animations without a timeline. |
| 65 return nullptr; | 65 return nullptr; |
| 66 } | 66 } |
| 67 | 67 |
| 68 RefPtrWillBeRawPtr<Animation> animation = adoptRefWillBeNoop(new Animation(t
imeline->document()->contextDocument().get(), *timeline, effect)); | 68 Animation* animation = new Animation(timeline->document()->contextDocument()
.get(), *timeline, effect); |
| 69 animation->suspendIfNeeded(); | 69 animation->suspendIfNeeded(); |
| 70 | 70 |
| 71 if (timeline) { | 71 if (timeline) { |
| 72 timeline->animationAttached(*animation); | 72 timeline->animationAttached(*animation); |
| 73 animation->attachCompositorTimeline(); | 73 animation->attachCompositorTimeline(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 return animation.release(); | 76 return animation; |
| 77 } | 77 } |
| 78 | 78 |
| 79 Animation::Animation(ExecutionContext* executionContext, AnimationTimeline& time
line, AnimationEffect* content) | 79 Animation::Animation(ExecutionContext* executionContext, AnimationTimeline& time
line, AnimationEffect* content) |
| 80 : ActiveDOMObject(executionContext) | 80 : ActiveDOMObject(executionContext) |
| 81 , m_playState(Idle) | 81 , m_playState(Idle) |
| 82 , m_playbackRate(1) | 82 , m_playbackRate(1) |
| 83 , m_startTime(nullValue()) | 83 , m_startTime(nullValue()) |
| 84 , m_holdTime(0) | 84 , m_holdTime(0) |
| 85 , m_startClip(-std::numeric_limits<double>::infinity()) | 85 , m_startClip(-std::numeric_limits<double>::infinity()) |
| 86 , m_endClip(std::numeric_limits<double>::infinity()) | 86 , m_endClip(std::numeric_limits<double>::infinity()) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 103 if (m_content->animation()) { | 103 if (m_content->animation()) { |
| 104 m_content->animation()->cancel(); | 104 m_content->animation()->cancel(); |
| 105 m_content->animation()->setEffect(0); | 105 m_content->animation()->setEffect(0); |
| 106 } | 106 } |
| 107 m_content->attach(this); | 107 m_content->attach(this); |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 | 110 |
| 111 Animation::~Animation() | 111 Animation::~Animation() |
| 112 { | 112 { |
| 113 destroyCompositorPlayer(); |
| 114 } |
| 115 |
| 116 void Animation::disposeAnimation() |
| 117 { |
| 113 #if !ENABLE(OILPAN) | 118 #if !ENABLE(OILPAN) |
| 114 if (m_content) | 119 if (m_content) |
| 115 m_content->detach(); | 120 m_content->detach(); |
| 116 if (m_timeline) | 121 if (m_timeline) |
| 117 m_timeline->animationDestroyed(this); | 122 m_timeline->animationDestroyed(this); |
| 118 #endif | 123 #endif |
| 119 | |
| 120 destroyCompositorPlayer(); | |
| 121 } | 124 } |
| 122 | 125 |
| 123 #if !ENABLE(OILPAN) | 126 #if !ENABLE(OILPAN) |
| 124 void Animation::detachFromTimeline() | 127 void Animation::detachFromTimeline() |
| 125 { | 128 { |
| 126 m_timeline = nullptr; | 129 m_timeline = nullptr; |
| 127 ActiveDOMObject::clearContext(); | 130 ActiveDOMObject::clearContext(); |
| 128 } | 131 } |
| 129 #endif | 132 #endif |
| 130 | 133 |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 cancelAnimationOnCompositor(); | 1097 cancelAnimationOnCompositor(); |
| 1095 } | 1098 } |
| 1096 | 1099 |
| 1097 DEFINE_TRACE(Animation) | 1100 DEFINE_TRACE(Animation) |
| 1098 { | 1101 { |
| 1099 visitor->trace(m_content); | 1102 visitor->trace(m_content); |
| 1100 visitor->trace(m_timeline); | 1103 visitor->trace(m_timeline); |
| 1101 visitor->trace(m_pendingFinishedEvent); | 1104 visitor->trace(m_pendingFinishedEvent); |
| 1102 visitor->trace(m_finishedPromise); | 1105 visitor->trace(m_finishedPromise); |
| 1103 visitor->trace(m_readyPromise); | 1106 visitor->trace(m_readyPromise); |
| 1104 EventTargetWithInlineData::trace(visitor); | 1107 RefCountedGarbageCollectedEventTargetWithInlineData<Animation>::trace(visito
r); |
| 1105 ActiveDOMObject::trace(visitor); | 1108 ActiveDOMObject::trace(visitor); |
| 1106 } | 1109 } |
| 1107 | 1110 |
| 1108 } // namespace | 1111 } // namespace |
| OLD | NEW |