Chromium Code Reviews| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 } | 65 } |
| 66 | 66 |
| 67 AnimationTimeline::AnimationTimeline(Document* document, PlatformTiming* timing) | 67 AnimationTimeline::AnimationTimeline(Document* document, PlatformTiming* timing) |
| 68 : m_document(document) | 68 : m_document(document) |
| 69 , m_zeroTime(0) // 0 is used by unit tests which cannot initialize from the loader | 69 , m_zeroTime(0) // 0 is used by unit tests which cannot initialize from the loader |
| 70 , m_zeroTimeInitialized(false) | 70 , m_zeroTimeInitialized(false) |
| 71 , m_outdatedAnimationCount(0) | 71 , m_outdatedAnimationCount(0) |
| 72 , m_playbackRate(1) | 72 , m_playbackRate(1) |
| 73 , m_lastCurrentTimeInternal(0) | 73 , m_lastCurrentTimeInternal(0) |
| 74 { | 74 { |
| 75 #if ENABLE(OILPAN) | |
| 76 ThreadState::current()->registerPreFinalizer(this); | |
| 77 #endif | |
| 75 if (!timing) | 78 if (!timing) |
| 76 m_timing = new AnimationTimelineTiming(this); | 79 m_timing = new AnimationTimelineTiming(this); |
| 77 else | 80 else |
| 78 m_timing = timing; | 81 m_timing = timing; |
| 79 | 82 |
| 80 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() && Platfor m::current()->isThreadedAnimationEnabled()) { | 83 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() && Platfor m::current()->isThreadedAnimationEnabled()) { |
| 81 ASSERT(Platform::current()->compositorSupport()); | 84 ASSERT(Platform::current()->compositorSupport()); |
| 82 m_compositorTimeline = adoptPtr(Platform::current()->compositorSupport() ->createAnimationTimeline()); | 85 m_compositorTimeline = adoptPtr(Platform::current()->compositorSupport() ->createAnimationTimeline()); |
| 83 } | 86 } |
| 84 | 87 |
| 85 ASSERT(document); | 88 ASSERT(document); |
| 86 } | 89 } |
| 87 | 90 |
| 88 AnimationTimeline::~AnimationTimeline() | 91 AnimationTimeline::~AnimationTimeline() |
| 89 { | 92 { |
| 90 } | 93 } |
| 91 | 94 |
| 95 void AnimationTimeline::dispose() | |
| 96 { | |
| 97 // The Animation objects depend on using this AnimationTimeline to | |
| 98 // unregister from its underlying compositor timeline. To arrange | |
| 99 // for that safely, this dispose() method will return first | |
| 100 // during prefinalization, notifying each Animation object of | |
| 101 // impending destruction. | |
|
haraken
2015/12/09 14:02:04
Why can't we add a pre-finalizer on Animation? The
sof
2015/12/09 14:04:33
There's many more of these.
| |
| 102 for (const auto& animation : m_animations) | |
| 103 animation->dispose(); | |
| 104 } | |
| 105 | |
| 92 bool AnimationTimeline::isActive() | 106 bool AnimationTimeline::isActive() |
| 93 { | 107 { |
| 94 return m_document && m_document->page(); | 108 return m_document && m_document->page(); |
| 95 } | 109 } |
| 96 | 110 |
| 97 void AnimationTimeline::animationAttached(Animation& animation) | 111 void AnimationTimeline::animationAttached(Animation& animation) |
| 98 { | 112 { |
| 99 ASSERT(animation.timeline() == this); | 113 ASSERT(animation.timeline() == this); |
| 100 ASSERT(!m_animations.contains(&animation)); | 114 ASSERT(!m_animations.contains(&animation)); |
| 101 m_animations.add(&animation); | 115 m_animations.add(&animation); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 346 | 360 |
| 347 DEFINE_TRACE(AnimationTimeline) | 361 DEFINE_TRACE(AnimationTimeline) |
| 348 { | 362 { |
| 349 visitor->trace(m_document); | 363 visitor->trace(m_document); |
| 350 visitor->trace(m_timing); | 364 visitor->trace(m_timing); |
| 351 visitor->trace(m_animationsNeedingUpdate); | 365 visitor->trace(m_animationsNeedingUpdate); |
| 352 visitor->trace(m_animations); | 366 visitor->trace(m_animations); |
| 353 } | 367 } |
| 354 | 368 |
| 355 } // namespace | 369 } // namespace |
| OLD | NEW |