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 21 matching lines...) Expand all Loading... | |
| 32 #include "core/animation/AnimationPlayer.h" | 32 #include "core/animation/AnimationPlayer.h" |
| 33 | 33 |
| 34 #include "core/animation/Animation.h" | 34 #include "core/animation/Animation.h" |
| 35 #include "core/animation/AnimationTimeline.h" | 35 #include "core/animation/AnimationTimeline.h" |
| 36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 37 #include "core/dom/ExceptionCode.h" | 37 #include "core/dom/ExceptionCode.h" |
| 38 #include "core/events/AnimationPlayerEvent.h" | 38 #include "core/events/AnimationPlayerEvent.h" |
| 39 #include "core/frame/UseCounter.h" | 39 #include "core/frame/UseCounter.h" |
| 40 #include "core/inspector/InspectorInstrumentation.h" | 40 #include "core/inspector/InspectorInstrumentation.h" |
| 41 #include "core/inspector/InspectorTraceEvents.h" | 41 #include "core/inspector/InspectorTraceEvents.h" |
| 42 #include "platform/RuntimeEnabledFeatures.h" | |
| 42 #include "platform/TraceEvent.h" | 43 #include "platform/TraceEvent.h" |
| 44 #include "public/platform/Platform.h" | |
| 45 #include "public/platform/WebCompositorAnimationPlayer.h" | |
| 46 #include "public/platform/WebCompositorSupport.h" | |
| 43 #include "wtf/MathExtras.h" | 47 #include "wtf/MathExtras.h" |
| 44 | 48 |
| 45 namespace blink { | 49 namespace blink { |
| 46 | 50 |
| 47 namespace { | 51 namespace { |
| 48 | 52 |
| 49 static unsigned nextSequenceNumber() | 53 static unsigned nextSequenceNumber() |
| 50 { | 54 { |
| 51 static unsigned next = 0; | 55 static unsigned next = 0; |
| 52 return ++next; | 56 return ++next; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 , m_held(true) | 88 , m_held(true) |
| 85 , m_isPausedForTesting(false) | 89 , m_isPausedForTesting(false) |
| 86 , m_outdated(false) | 90 , m_outdated(false) |
| 87 , m_finished(true) | 91 , m_finished(true) |
| 88 , m_compositorState(nullptr) | 92 , m_compositorState(nullptr) |
| 89 , m_compositorPending(false) | 93 , m_compositorPending(false) |
| 90 , m_compositorGroup(0) | 94 , m_compositorGroup(0) |
| 91 , m_currentTimePending(false) | 95 , m_currentTimePending(false) |
| 92 , m_stateIsBeingUpdated(false) | 96 , m_stateIsBeingUpdated(false) |
| 93 { | 97 { |
| 98 createCompositorPlayer(); | |
| 99 | |
| 94 if (m_content) { | 100 if (m_content) { |
| 95 if (m_content->player()) { | 101 if (m_content->player()) { |
| 96 m_content->player()->cancel(); | 102 m_content->player()->cancel(); |
| 97 m_content->player()->setSource(0); | 103 m_content->player()->setSource(0); |
| 98 } | 104 } |
| 99 m_content->attach(this); | 105 m_content->attach(this); |
| 100 } | 106 } |
| 101 } | 107 } |
| 102 | 108 |
| 103 AnimationPlayer::~AnimationPlayer() | 109 AnimationPlayer::~AnimationPlayer() |
| 104 { | 110 { |
| 105 #if !ENABLE(OILPAN) | 111 #if !ENABLE(OILPAN) |
| 106 if (m_content) | 112 if (m_content) |
| 107 m_content->detach(); | 113 m_content->detach(); |
| 108 if (m_timeline) | 114 if (m_timeline) |
| 109 m_timeline->playerDestroyed(this); | 115 m_timeline->playerDestroyed(this); |
| 110 #endif | 116 #endif |
| 117 | |
| 118 destroyCompositorPlayer(); | |
| 111 } | 119 } |
| 112 | 120 |
| 113 double AnimationPlayer::sourceEnd() const | 121 double AnimationPlayer::sourceEnd() const |
| 114 { | 122 { |
| 115 return m_content ? m_content->endTimeInternal() : 0; | 123 return m_content ? m_content->endTimeInternal() : 0; |
| 116 } | 124 } |
| 117 | 125 |
| 118 bool AnimationPlayer::limited(double currentTime) const | 126 bool AnimationPlayer::limited(double currentTime) const |
| 119 { | 127 { |
| 120 return (m_playbackRate < 0 && currentTime <= 0) || (m_playbackRate > 0 && cu rrentTime >= sourceEnd()); | 128 return (m_playbackRate < 0 && currentTime <= 0) || (m_playbackRate > 0 && cu rrentTime >= sourceEnd()); |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 823 ASSERT(!m_stateIsBeingUpdated); | 831 ASSERT(!m_stateIsBeingUpdated); |
| 824 m_stateIsBeingUpdated = true; | 832 m_stateIsBeingUpdated = true; |
| 825 } | 833 } |
| 826 | 834 |
| 827 void AnimationPlayer::endUpdatingState() | 835 void AnimationPlayer::endUpdatingState() |
| 828 { | 836 { |
| 829 ASSERT(m_stateIsBeingUpdated); | 837 ASSERT(m_stateIsBeingUpdated); |
| 830 m_stateIsBeingUpdated = false; | 838 m_stateIsBeingUpdated = false; |
| 831 } | 839 } |
| 832 | 840 |
| 841 void AnimationPlayer::createCompositorPlayer() | |
| 842 { | |
| 843 if (Platform::current()->compositorSupport() && RuntimeEnabledFeatures::comp ositorAnimationTimelinesEnabled()) { | |
|
dstockwell
2015/03/16 00:11:27
For consistency I think it's best to check the run
loyso (OOO)
2015/03/18 06:59:43
Done.
| |
| 844 m_compositorPlayer = adoptPtr(Platform::current()->compositorSupport()-> createAnimationPlayer()); | |
| 845 if (m_compositorPlayer) | |
|
dstockwell
2015/03/16 00:11:27
How can this be null?
loyso (OOO)
2015/03/18 06:59:43
If chromium side isn't landed and we run with --en
dstockwell
2015/03/18 07:17:18
Yes it sounds like an invalid configuration, just
loyso (OOO)
2015/03/19 02:32:24
Done.
loyso (OOO)
2015/03/24 02:50:56
I recall now! In webkit_unit_tests it crashes. We
loyso (OOO)
2015/03/24 02:55:17
UPDATE: It's ok since we have a flag now :)
| |
| 846 m_compositorPlayer->setAnimationDelegate(this); | |
| 847 } | |
| 848 } | |
| 849 | |
| 850 void AnimationPlayer::destroyCompositorPlayer() | |
| 851 { | |
| 852 if (m_compositorPlayer) | |
| 853 m_compositorPlayer->setAnimationDelegate(nullptr); | |
| 854 m_compositorPlayer.clear(); | |
| 855 } | |
| 856 | |
| 857 void AnimationPlayer::notifyAnimationStarted(double monotonicTime, int group) | |
| 858 { | |
| 859 timeline()->document()->compositorPendingAnimations().notifyCompositorAnimat ionStarted(monotonicTime, group); | |
|
dstockwell
2015/03/16 00:11:27
ASSERT compositorAnimationTimelinesEnabled()
loyso (OOO)
2015/03/18 06:59:43
Done.
| |
| 860 } | |
| 861 | |
| 833 AnimationPlayer::PlayStateUpdateScope::PlayStateUpdateScope(AnimationPlayer& pla yer, TimingUpdateReason reason, CompositorPendingChange compositorPendingChange) | 862 AnimationPlayer::PlayStateUpdateScope::PlayStateUpdateScope(AnimationPlayer& pla yer, TimingUpdateReason reason, CompositorPendingChange compositorPendingChange) |
| 834 : m_player(player) | 863 : m_player(player) |
| 835 , m_initialPlayState(m_player->playStateInternal()) | 864 , m_initialPlayState(m_player->playStateInternal()) |
| 836 , m_compositorPendingChange(compositorPendingChange) | 865 , m_compositorPendingChange(compositorPendingChange) |
| 837 { | 866 { |
| 838 m_player->beginUpdatingState(); | 867 m_player->beginUpdatingState(); |
| 839 m_player->updateCurrentTimingState(reason); | 868 m_player->updateCurrentTimingState(reason); |
| 840 } | 869 } |
| 841 | 870 |
| 842 AnimationPlayer::PlayStateUpdateScope::~PlayStateUpdateScope() | 871 AnimationPlayer::PlayStateUpdateScope::~PlayStateUpdateScope() |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 936 visitor->trace(m_content); | 965 visitor->trace(m_content); |
| 937 visitor->trace(m_timeline); | 966 visitor->trace(m_timeline); |
| 938 visitor->trace(m_pendingFinishedEvent); | 967 visitor->trace(m_pendingFinishedEvent); |
| 939 visitor->trace(m_finishedPromise); | 968 visitor->trace(m_finishedPromise); |
| 940 visitor->trace(m_readyPromise); | 969 visitor->trace(m_readyPromise); |
| 941 EventTargetWithInlineData::trace(visitor); | 970 EventTargetWithInlineData::trace(visitor); |
| 942 ActiveDOMObject::trace(visitor); | 971 ActiveDOMObject::trace(visitor); |
| 943 } | 972 } |
| 944 | 973 |
| 945 } // namespace | 974 } // namespace |
| OLD | NEW |