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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 } | 66 } |
67 | 67 |
68 AnimationTimeline::AnimationTimeline(Document* document, PlatformTiming* timing) | 68 AnimationTimeline::AnimationTimeline(Document* document, PlatformTiming* timing) |
69 : m_document(document) | 69 : m_document(document) |
70 , m_zeroTime(0) // 0 is used by unit tests which cannot initialize from the loader | 70 , m_zeroTime(0) // 0 is used by unit tests which cannot initialize from the loader |
71 , m_zeroTimeInitialized(false) | 71 , m_zeroTimeInitialized(false) |
72 , m_outdatedAnimationCount(0) | 72 , m_outdatedAnimationCount(0) |
73 , m_playbackRate(1) | 73 , m_playbackRate(1) |
74 , m_lastCurrentTimeInternal(0) | 74 , m_lastCurrentTimeInternal(0) |
75 { | 75 { |
76 ThreadState::current()->registerPreFinalizer(this); | |
77 if (!timing) | 76 if (!timing) |
78 m_timing = new AnimationTimelineTiming(this); | 77 m_timing = new AnimationTimelineTiming(this); |
79 else | 78 else |
80 m_timing = timing; | 79 m_timing = timing; |
81 | 80 |
82 if (Platform::current()->isThreadedAnimationEnabled()) | 81 if (Platform::current()->isThreadedAnimationEnabled()) |
83 m_compositorTimeline = CompositorAnimationTimeline::create(); | 82 m_compositorTimeline = CompositorAnimationTimeline::create(); |
84 | 83 |
85 ASSERT(document); | 84 ASSERT(document); |
86 } | 85 } |
87 | 86 |
88 AnimationTimeline::~AnimationTimeline() | 87 AnimationTimeline::~AnimationTimeline() |
89 { | 88 { |
90 } | |
91 | |
92 void AnimationTimeline::dispose() | |
93 { | |
94 // The Animation objects depend on using this AnimationTimeline to | 89 // The Animation objects depend on using this AnimationTimeline to |
95 // unregister from its underlying compositor timeline. To arrange | 90 // unregister from its underlying compositor timeline. |
96 // for that safely, this dispose() method will return first | |
97 // during prefinalization, notifying each Animation object of | |
98 // impending destruction. | |
99 for (const auto& animation : m_animations) | 91 for (const auto& animation : m_animations) |
100 animation->dispose(); | 92 animation->dispose(); |
haraken
2016/07/28 12:04:26
I was assuming that we can entirely stop calling a
| |
101 } | 93 } |
102 | 94 |
103 bool AnimationTimeline::isActive() | 95 bool AnimationTimeline::isActive() |
104 { | 96 { |
105 return m_document && m_document->page(); | 97 return m_document && m_document->page(); |
106 } | 98 } |
107 | 99 |
108 void AnimationTimeline::animationAttached(Animation& animation) | 100 void AnimationTimeline::animationAttached(Animation& animation) |
109 { | 101 { |
110 ASSERT(animation.timeline() == this); | 102 ASSERT(animation.timeline() == this); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
355 | 347 |
356 DEFINE_TRACE(AnimationTimeline) | 348 DEFINE_TRACE(AnimationTimeline) |
357 { | 349 { |
358 visitor->trace(m_document); | 350 visitor->trace(m_document); |
359 visitor->trace(m_timing); | 351 visitor->trace(m_timing); |
360 visitor->trace(m_animationsNeedingUpdate); | 352 visitor->trace(m_animationsNeedingUpdate); |
361 visitor->trace(m_animations); | 353 visitor->trace(m_animations); |
362 } | 354 } |
363 | 355 |
364 } // namespace blink | 356 } // namespace blink |
OLD | NEW |