| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 { | 76 { |
| 77 if (m_content) { | 77 if (m_content) { |
| 78 if (m_content->player()) | 78 if (m_content->player()) |
| 79 m_content->player()->cancel(); | 79 m_content->player()->cancel(); |
| 80 m_content->attach(this); | 80 m_content->attach(this); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 AnimationPlayer::~AnimationPlayer() | 84 AnimationPlayer::~AnimationPlayer() |
| 85 { | 85 { |
| 86 #if !ENABLE(OILPAN) | |
| 87 if (m_content) | 86 if (m_content) |
| 88 m_content->detach(); | 87 m_content->detach(); |
| 89 if (m_timeline) | 88 if (m_timeline) |
| 90 m_timeline->playerDestroyed(this); | 89 m_timeline->playerDestroyed(this); |
| 91 #endif | |
| 92 } | 90 } |
| 93 | 91 |
| 94 double AnimationPlayer::sourceEnd() const | 92 double AnimationPlayer::sourceEnd() const |
| 95 { | 93 { |
| 96 return m_content ? m_content->endTimeInternal() : 0; | 94 return m_content ? m_content->endTimeInternal() : 0; |
| 97 } | 95 } |
| 98 | 96 |
| 99 bool AnimationPlayer::limited(double currentTime) const | 97 bool AnimationPlayer::limited(double currentTime) const |
| 100 { | 98 { |
| 101 return (m_playbackRate < 0 && currentTime <= 0) || (m_playbackRate > 0 && cu
rrentTime >= sourceEnd()); | 99 return (m_playbackRate < 0 && currentTime <= 0) || (m_playbackRate > 0 && cu
rrentTime >= sourceEnd()); |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 if (m_playbackRate > 0) | 624 if (m_playbackRate > 0) |
| 627 return m_content->timeToForwardsEffectChange() / m_playbackRate; | 625 return m_content->timeToForwardsEffectChange() / m_playbackRate; |
| 628 return m_content->timeToReverseEffectChange() / -m_playbackRate; | 626 return m_content->timeToReverseEffectChange() / -m_playbackRate; |
| 629 } | 627 } |
| 630 | 628 |
| 631 void AnimationPlayer::cancel() | 629 void AnimationPlayer::cancel() |
| 632 { | 630 { |
| 633 setSource(0); | 631 setSource(0); |
| 634 } | 632 } |
| 635 | 633 |
| 636 #if !ENABLE(OILPAN) | |
| 637 bool AnimationPlayer::canFree() const | 634 bool AnimationPlayer::canFree() const |
| 638 { | 635 { |
| 639 ASSERT(m_content); | 636 ASSERT(m_content); |
| 640 return hasOneRef() && m_content->isAnimation() && m_content->hasOneRef(); | 637 return hasOneRef() && m_content->isAnimation() && m_content->hasOneRef(); |
| 641 } | 638 } |
| 642 #endif | |
| 643 | 639 |
| 644 bool AnimationPlayer::addEventListener(const AtomicString& eventType, PassRefPtr
<EventListener> listener, bool useCapture) | 640 bool AnimationPlayer::addEventListener(const AtomicString& eventType, PassRefPtr
<EventListener> listener, bool useCapture) |
| 645 { | 641 { |
| 646 if (eventType == EventTypeNames::finish) | 642 if (eventType == EventTypeNames::finish) |
| 647 UseCounter::count(executionContext(), UseCounter::AnimationPlayerFinishE
vent); | 643 UseCounter::count(executionContext(), UseCounter::AnimationPlayerFinishE
vent); |
| 648 return EventTargetWithInlineData::addEventListener(eventType, listener, useC
apture); | 644 return EventTargetWithInlineData::addEventListener(eventType, listener, useC
apture); |
| 649 } | 645 } |
| 650 | 646 |
| 651 void AnimationPlayer::pauseForTesting(double pauseTime) | 647 void AnimationPlayer::pauseForTesting(double pauseTime) |
| 652 { | 648 { |
| 653 RELEASE_ASSERT(!paused()); | 649 RELEASE_ASSERT(!paused()); |
| 654 setCurrentTimeInternal(pauseTime, TimingUpdateOnDemand); | 650 setCurrentTimeInternal(pauseTime, TimingUpdateOnDemand); |
| 655 if (hasActiveAnimationsOnCompositor()) | 651 if (hasActiveAnimationsOnCompositor()) |
| 656 toAnimation(m_content.get())->pauseAnimationForTestingOnCompositor(curre
ntTimeInternal()); | 652 toAnimation(m_content.get())->pauseAnimationForTestingOnCompositor(curre
ntTimeInternal()); |
| 657 m_isPausedForTesting = true; | 653 m_isPausedForTesting = true; |
| 658 pause(); | 654 pause(); |
| 659 } | 655 } |
| 660 | 656 |
| 661 void AnimationPlayer::trace(Visitor* visitor) | 657 void AnimationPlayer::trace(Visitor* visitor) |
| 662 { | 658 { |
| 663 visitor->trace(m_content); | 659 visitor->trace(m_content); |
| 664 visitor->trace(m_timeline); | 660 visitor->trace(m_timeline); |
| 665 visitor->trace(m_pendingFinishedEvent); | 661 visitor->trace(m_pendingFinishedEvent); |
| 666 EventTargetWithInlineData::trace(visitor); | 662 EventTargetWithInlineData::trace(visitor); |
| 667 } | 663 } |
| 668 | 664 |
| 669 } // namespace | 665 } // namespace |
| OLD | NEW |