Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: third_party/WebKit/Source/core/animation/Animation.cpp

Issue 2536523002: Blink Animation: Extend Animation's GC lifetime if it has a finish promise. (Closed)
Patch Set: Fix memory leaks. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/web-animations-api/animation-finish-promise-gc.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 644
645 const AtomicString& Animation::interfaceName() const { 645 const AtomicString& Animation::interfaceName() const {
646 return EventTargetNames::AnimationPlayer; 646 return EventTargetNames::AnimationPlayer;
647 } 647 }
648 648
649 ExecutionContext* Animation::getExecutionContext() const { 649 ExecutionContext* Animation::getExecutionContext() const {
650 return ActiveDOMObject::getExecutionContext(); 650 return ActiveDOMObject::getExecutionContext();
651 } 651 }
652 652
653 bool Animation::hasPendingActivity() const { 653 bool Animation::hasPendingActivity() const {
654 return m_pendingFinishedEvent || 654 bool hasPendingPromise =
655 !m_finished && m_finishedPromise &&
656 m_finishedPromise->getState() == ScriptPromisePropertyBase::Pending;
657
658 return m_pendingFinishedEvent || hasPendingPromise ||
655 (!m_finished && hasEventListeners(EventTypeNames::finish)); 659 (!m_finished && hasEventListeners(EventTypeNames::finish));
656 } 660 }
657 661
658 void Animation::contextDestroyed() { 662 void Animation::contextDestroyed() {
659 PlayStateUpdateScope updateScope(*this, TimingUpdateOnDemand); 663 PlayStateUpdateScope updateScope(*this, TimingUpdateOnDemand);
660 664
661 m_finished = true; 665 m_finished = true;
662 m_pendingFinishedEvent = nullptr; 666 m_pendingFinishedEvent = nullptr;
663 } 667 }
664 668
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 visitor->trace(m_timeline); 1124 visitor->trace(m_timeline);
1121 visitor->trace(m_pendingFinishedEvent); 1125 visitor->trace(m_pendingFinishedEvent);
1122 visitor->trace(m_pendingCancelledEvent); 1126 visitor->trace(m_pendingCancelledEvent);
1123 visitor->trace(m_finishedPromise); 1127 visitor->trace(m_finishedPromise);
1124 visitor->trace(m_readyPromise); 1128 visitor->trace(m_readyPromise);
1125 EventTargetWithInlineData::trace(visitor); 1129 EventTargetWithInlineData::trace(visitor);
1126 ActiveDOMObject::trace(visitor); 1130 ActiveDOMObject::trace(visitor);
1127 } 1131 }
1128 1132
1129 } // namespace blink 1133 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/web-animations-api/animation-finish-promise-gc.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698