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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 return AnimationPlayer::hasLowerPriority(left.get(), right.get()); | 52 return AnimationPlayer::hasLowerPriority(left.get(), right.get()); |
| 53 } | 53 } |
| 54 | 54 |
| 55 } | 55 } |
| 56 | 56 |
| 57 // This value represents 1 frame at 30Hz plus a little bit of wiggle room. | 57 // This value represents 1 frame at 30Hz plus a little bit of wiggle room. |
| 58 // TODO: Plumb a nominal framerate through and derive this value from that. | 58 // TODO: Plumb a nominal framerate through and derive this value from that. |
| 59 const double AnimationTimeline::s_minimumDelay = 0.04; | 59 const double AnimationTimeline::s_minimumDelay = 0.04; |
| 60 | 60 |
| 61 | 61 |
| 62 PassRefPtrWillBeRawPtr<AnimationTimeline> AnimationTimeline::create(Document* do cument, PassOwnPtrWillBeRawPtr<PlatformTiming> timing) | 62 AnimationTimeline* AnimationTimeline::create(Document* document, PlatformTiming* timing) |
| 63 { | 63 { |
| 64 return adoptRefWillBeNoop(new AnimationTimeline(document, timing)); | 64 return new AnimationTimeline(document, timing); |
| 65 } | 65 } |
| 66 | 66 |
| 67 AnimationTimeline::AnimationTimeline(Document* document, PassOwnPtrWillBeRawPtr< 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_playbackRate(1) | 71 , m_playbackRate(1) |
| 72 , m_lastCurrentTimeInternal(0) | 72 , m_lastCurrentTimeInternal(0) |
| 73 { | 73 { |
| 74 if (!timing) | 74 if (!timing) |
| 75 m_timing = adoptPtrWillBeNoop(new AnimationTimelineTiming(this)); | 75 m_timing = new AnimationTimelineTiming(this); |
| 76 else | 76 else |
| 77 m_timing = timing; | 77 m_timing = timing; |
| 78 | 78 |
| 79 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() && Platfor m::current()->compositorSupport()) | 79 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() && Platfor m::current()->compositorSupport()) |
| 80 m_compositorTimeline = adoptPtr(Platform::current()->compositorSupport() ->createAnimationTimeline()); | 80 m_compositorTimeline = adoptPtr(Platform::current()->compositorSupport() ->createAnimationTimeline()); |
| 81 | 81 |
| 82 ASSERT(document); | 82 ASSERT(document); |
| 83 } | 83 } |
| 84 | 84 |
| 85 AnimationTimeline::~AnimationTimeline() | 85 AnimationTimeline::~AnimationTimeline() |
| 86 { | 86 { |
| 87 #if !ENABLE(OILPAN) | |
| 88 for (const auto& player : m_players) | |
| 89 player->detachFromTimeline(); | |
| 90 #endif | |
| 91 } | 87 } |
| 92 | 88 |
| 93 void AnimationTimeline::playerAttached(AnimationPlayer& player) | 89 void AnimationTimeline::playerAttached(AnimationPlayer& player) |
| 94 { | 90 { |
| 95 ASSERT(player.timeline() == this); | 91 ASSERT(player.timeline() == this); |
| 96 ASSERT(!m_players.contains(&player)); | 92 ASSERT(!m_players.contains(&player)); |
| 97 m_players.add(&player); | 93 m_players.add(&player); |
| 98 } | 94 } |
| 99 | 95 |
| 100 AnimationPlayer* AnimationTimeline::play(AnimationNode* child) | 96 AnimationPlayer* AnimationTimeline::play(AnimationNode* child) |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 // the new playback rate. Marking the source changed forces this. | 296 // the new playback rate. Marking the source changed forces this. |
| 301 player->setCompositorPending(true); | 297 player->setCompositorPending(true); |
| 302 } | 298 } |
| 303 } | 299 } |
| 304 | 300 |
| 305 double AnimationTimeline::playbackRate() const | 301 double AnimationTimeline::playbackRate() const |
| 306 { | 302 { |
| 307 return m_playbackRate; | 303 return m_playbackRate; |
| 308 } | 304 } |
| 309 | 305 |
| 310 #if !ENABLE(OILPAN) | |
| 311 void AnimationTimeline::detachFromDocument() | |
|
haraken
2015/05/08 00:13:06
Since Document is not yet moved to oilpan by defau
peria
2015/05/08 02:21:20
Acknowledged.
| |
| 312 { | |
| 313 // FIXME: AnimationTimeline should keep Document alive. | |
| 314 m_document = nullptr; | |
| 315 } | |
| 316 #endif | |
| 317 | |
| 318 DEFINE_TRACE(AnimationTimeline) | 306 DEFINE_TRACE(AnimationTimeline) |
| 319 { | 307 { |
| 308 visitor->trace(m_timing); | |
| 320 #if ENABLE(OILPAN) | 309 #if ENABLE(OILPAN) |
| 321 visitor->trace(m_document); | 310 visitor->trace(m_document); |
| 322 visitor->trace(m_timing); | |
| 323 visitor->trace(m_playersNeedingUpdate); | 311 visitor->trace(m_playersNeedingUpdate); |
| 324 visitor->trace(m_players); | 312 visitor->trace(m_players); |
| 325 #endif | 313 #endif |
| 326 } | 314 } |
| 327 | 315 |
| 328 } // namespace | 316 } // namespace |
| OLD | NEW |