| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include "core/animation/Animation.h" | 31 #include "core/animation/Animation.h" |
| 32 | 32 |
| 33 #include "core/animation/AnimationTimeline.h" | 33 #include "core/animation/AnimationTimeline.h" |
| 34 #include "core/animation/CompositorPendingAnimations.h" | 34 #include "core/animation/CompositorPendingAnimations.h" |
| 35 #include "core/animation/KeyframeEffectReadOnly.h" | 35 #include "core/animation/KeyframeEffectReadOnly.h" |
| 36 #include "core/animation/css/CSSAnimations.h" | 36 #include "core/animation/css/CSSAnimations.h" |
| 37 #include "core/dom/DOMNodeIds.h" | 37 #include "core/dom/DOMNodeIds.h" |
| 38 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
| 39 #include "core/dom/ExceptionCode.h" | 39 #include "core/dom/ExceptionCode.h" |
| 40 #include "core/dom/ExecutionContext.h" |
| 40 #include "core/dom/StyleChangeReason.h" | 41 #include "core/dom/StyleChangeReason.h" |
| 41 #include "core/dom/TaskRunnerHelper.h" | 42 #include "core/dom/TaskRunnerHelper.h" |
| 42 #include "core/events/AnimationPlaybackEvent.h" | 43 #include "core/events/AnimationPlaybackEvent.h" |
| 43 #include "core/frame/UseCounter.h" | 44 #include "core/frame/UseCounter.h" |
| 44 #include "core/inspector/InspectorTraceEvents.h" | 45 #include "core/inspector/InspectorTraceEvents.h" |
| 45 #include "core/probe/CoreProbes.h" | 46 #include "core/probe/CoreProbes.h" |
| 46 #include "platform/RuntimeEnabledFeatures.h" | 47 #include "platform/RuntimeEnabledFeatures.h" |
| 47 #include "platform/WebTaskRunner.h" | 48 #include "platform/WebTaskRunner.h" |
| 48 #include "platform/animation/CompositorAnimationPlayer.h" | 49 #include "platform/animation/CompositorAnimationPlayer.h" |
| 49 #include "platform/heap/Persistent.h" | 50 #include "platform/heap/Persistent.h" |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 SetCurrentTimeInternal(new_current_time, kTimingUpdateOnDemand); | 623 SetCurrentTimeInternal(new_current_time, kTimingUpdateOnDemand); |
| 623 paused_ = false; | 624 paused_ = false; |
| 624 current_time_pending_ = false; | 625 current_time_pending_ = false; |
| 625 start_time_ = CalculateStartTime(new_current_time); | 626 start_time_ = CalculateStartTime(new_current_time); |
| 626 play_state_ = kFinished; | 627 play_state_ = kFinished; |
| 627 ForceServiceOnNextFrame(); | 628 ForceServiceOnNextFrame(); |
| 628 } | 629 } |
| 629 | 630 |
| 630 ScriptPromise Animation::finished(ScriptState* script_state) { | 631 ScriptPromise Animation::finished(ScriptState* script_state) { |
| 631 if (!finished_promise_) { | 632 if (!finished_promise_) { |
| 632 finished_promise_ = new AnimationPromise( | 633 finished_promise_ = |
| 633 script_state->GetExecutionContext(), this, AnimationPromise::kFinished); | 634 new AnimationPromise(ExecutionContext::From(script_state), this, |
| 635 AnimationPromise::kFinished); |
| 634 if (PlayStateInternal() == kFinished) | 636 if (PlayStateInternal() == kFinished) |
| 635 finished_promise_->Resolve(this); | 637 finished_promise_->Resolve(this); |
| 636 } | 638 } |
| 637 return finished_promise_->Promise(script_state->World()); | 639 return finished_promise_->Promise(script_state->World()); |
| 638 } | 640 } |
| 639 | 641 |
| 640 ScriptPromise Animation::ready(ScriptState* script_state) { | 642 ScriptPromise Animation::ready(ScriptState* script_state) { |
| 641 if (!ready_promise_) { | 643 if (!ready_promise_) { |
| 642 ready_promise_ = new AnimationPromise(script_state->GetExecutionContext(), | 644 ready_promise_ = new AnimationPromise(ExecutionContext::From(script_state), |
| 643 this, AnimationPromise::kReady); | 645 this, AnimationPromise::kReady); |
| 644 if (PlayStateInternal() != kPending) | 646 if (PlayStateInternal() != kPending) |
| 645 ready_promise_->Resolve(this); | 647 ready_promise_->Resolve(this); |
| 646 } | 648 } |
| 647 return ready_promise_->Promise(script_state->World()); | 649 return ready_promise_->Promise(script_state->World()); |
| 648 } | 650 } |
| 649 | 651 |
| 650 const AtomicString& Animation::InterfaceName() const { | 652 const AtomicString& Animation::InterfaceName() const { |
| 651 return EventTargetNames::AnimationPlayer; | 653 return EventTargetNames::AnimationPlayer; |
| 652 } | 654 } |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 DCHECK(!compositor_player_); | 1177 DCHECK(!compositor_player_); |
| 1176 } | 1178 } |
| 1177 | 1179 |
| 1178 void Animation::CompositorAnimationPlayerHolder::Detach() { | 1180 void Animation::CompositorAnimationPlayerHolder::Detach() { |
| 1179 DCHECK(compositor_player_); | 1181 DCHECK(compositor_player_); |
| 1180 compositor_player_->SetAnimationDelegate(nullptr); | 1182 compositor_player_->SetAnimationDelegate(nullptr); |
| 1181 animation_ = nullptr; | 1183 animation_ = nullptr; |
| 1182 compositor_player_.reset(); | 1184 compositor_player_.reset(); |
| 1183 } | 1185 } |
| 1184 } // namespace blink | 1186 } // namespace blink |
| OLD | NEW |