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* source, Ani
mationTimeline* timeline) | 61 Animation* Animation::create(AnimationEffect* source, 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, source)); | 68 Animation* animation = new Animation(timeline->document()->contextDocument()
.get(), *timeline, source); |
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_sequenceNumber(nextSequenceNumber()) | 85 , m_sequenceNumber(nextSequenceNumber()) |
86 , m_content(content) | 86 , m_content(content) |
(...skipping 13 matching lines...) Expand all Loading... |
100 if (m_content->animation()) { | 100 if (m_content->animation()) { |
101 m_content->animation()->cancel(); | 101 m_content->animation()->cancel(); |
102 m_content->animation()->setSource(0); | 102 m_content->animation()->setSource(0); |
103 } | 103 } |
104 m_content->attach(this); | 104 m_content->attach(this); |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 Animation::~Animation() | 108 Animation::~Animation() |
109 { | 109 { |
| 110 destroyCompositorPlayer(); |
| 111 } |
| 112 |
| 113 void Animation::disposeAnimation() |
| 114 { |
110 #if !ENABLE(OILPAN) | 115 #if !ENABLE(OILPAN) |
111 if (m_content) | 116 if (m_content) |
112 m_content->detach(); | 117 m_content->detach(); |
113 if (m_timeline) | 118 if (m_timeline) |
114 m_timeline->animationDestroyed(this); | 119 m_timeline->animationDestroyed(this); |
115 #endif | 120 #endif |
116 | |
117 destroyCompositorPlayer(); | |
118 } | 121 } |
119 | 122 |
120 #if !ENABLE(OILPAN) | 123 #if !ENABLE(OILPAN) |
121 void Animation::detachFromTimeline() | 124 void Animation::detachFromTimeline() |
122 { | 125 { |
123 dispose(); | 126 dispose(); |
124 m_timeline = nullptr; | 127 m_timeline = nullptr; |
125 } | 128 } |
126 #endif | 129 #endif |
127 | 130 |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 visitor->trace(m_content); | 1026 visitor->trace(m_content); |
1024 visitor->trace(m_timeline); | 1027 visitor->trace(m_timeline); |
1025 visitor->trace(m_pendingFinishedEvent); | 1028 visitor->trace(m_pendingFinishedEvent); |
1026 visitor->trace(m_finishedPromise); | 1029 visitor->trace(m_finishedPromise); |
1027 visitor->trace(m_readyPromise); | 1030 visitor->trace(m_readyPromise); |
1028 EventTargetWithInlineData::trace(visitor); | 1031 EventTargetWithInlineData::trace(visitor); |
1029 ActiveDOMObject::trace(visitor); | 1032 ActiveDOMObject::trace(visitor); |
1030 } | 1033 } |
1031 | 1034 |
1032 } // namespace | 1035 } // namespace |
OLD | NEW |