Chromium Code Reviews| Index: third_party/WebKit/Source/core/animation/Animation.cpp |
| diff --git a/third_party/WebKit/Source/core/animation/Animation.cpp b/third_party/WebKit/Source/core/animation/Animation.cpp |
| index 5af7bf2ce5ecabb33082d36838744307ba5c1aec..3d927fb044ffd126cfa89ee3357f5411d6384c55 100644 |
| --- a/third_party/WebKit/Source/core/animation/Animation.cpp |
| +++ b/third_party/WebKit/Source/core/animation/Animation.cpp |
| @@ -37,12 +37,15 @@ |
| #include "core/dom/Document.h" |
| #include "core/dom/ExceptionCode.h" |
| #include "core/dom/StyleChangeReason.h" |
| +#include "core/dom/TaskRunnerHelper.h" |
| #include "core/events/AnimationPlaybackEvent.h" |
| #include "core/frame/UseCounter.h" |
| #include "core/inspector/InspectorInstrumentation.h" |
| #include "core/inspector/InspectorTraceEvents.h" |
| #include "platform/RuntimeEnabledFeatures.h" |
| +#include "platform/WebTaskRunner.h" |
| #include "platform/animation/CompositorAnimationPlayer.h" |
| +#include "platform/heap/Persistent.h" |
| #include "platform/instrumentation/tracing/TraceEvent.h" |
| #include "public/platform/Platform.h" |
| #include "public/platform/WebCompositorSupport.h" |
| @@ -650,7 +653,7 @@ ExecutionContext* Animation::getExecutionContext() const { |
| bool Animation::hasPendingActivity() const { |
| bool hasPendingPromise = |
| - !m_finished && m_finishedPromise && |
| + m_finishedPromise && |
| m_finishedPromise->getState() == ScriptPromisePropertyBase::Pending; |
| return m_pendingFinishedEvent || hasPendingPromise || |
| @@ -1012,9 +1015,9 @@ Animation::PlayStateUpdateScope::~PlayStateUpdateScope() { |
| m_animation->m_readyPromise->reject(DOMException::create(AbortError)); |
| } |
| m_animation->m_readyPromise->reset(); |
| - m_animation->m_readyPromise->resolve(m_animation); |
| + m_animation->resolvePromiseAsync(m_animation->m_readyPromise); |
| } else if (oldPlayState == Pending) { |
| - m_animation->m_readyPromise->resolve(m_animation); |
| + m_animation->resolvePromiseAsync(m_animation->m_readyPromise); |
| } else if (newPlayState == Pending) { |
| DCHECK_NE(m_animation->m_readyPromise->getState(), |
| AnimationPromise::Pending); |
| @@ -1031,7 +1034,7 @@ Animation::PlayStateUpdateScope::~PlayStateUpdateScope() { |
| } |
| m_animation->m_finishedPromise->reset(); |
| } else if (newPlayState == Finished) { |
| - m_animation->m_finishedPromise->resolve(m_animation); |
| + m_animation->resolvePromiseAsync(m_animation->m_finishedPromise); |
| } else if (oldPlayState == Finished) { |
| m_animation->m_finishedPromise->reset(); |
| } |
| @@ -1109,6 +1112,14 @@ void Animation::invalidateKeyframeEffect(const TreeScope& treeScope) { |
| StyleChangeReason::StyleSheetChange)); |
| } |
| +void Animation::resolvePromiseAsync(Member<AnimationPromise> promise) { |
| + TaskRunnerHelper::get(TaskType::DOMManipulation, getExecutionContext()) |
| + ->postTask( |
| + BLINK_FROM_HERE, |
| + WTF::bind(&AnimationPromise::resolve<Member<Animation>>, |
|
jbroman
2017/01/07 04:06:35
nit: Similarly, I'd expect this to be AnimationPro
|
| + wrapPersistent(promise.get()), wrapPersistent(this))); |
| +} |
| + |
| DEFINE_TRACE(Animation) { |
| visitor->trace(m_content); |
| visitor->trace(m_timeline); |