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

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

Issue 2188993004: Remove AnimationTimeline pre-finalizer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_fixAnimationPoisonCrash
Patch Set: Rebase Created 4 years, 4 months 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/Source/core/animation/AnimationTimeline.h ('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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 AnimationTimeline::AnimationTimeline(Document* document, PlatformTiming* timing) 68 AnimationTimeline::AnimationTimeline(Document* document, PlatformTiming* timing)
69 : m_document(document) 69 : m_document(document)
70 , m_zeroTime(0) // 0 is used by unit tests which cannot initialize from the loader 70 , m_zeroTime(0) // 0 is used by unit tests which cannot initialize from the loader
71 , m_zeroTimeInitialized(false) 71 , m_zeroTimeInitialized(false)
72 , m_outdatedAnimationCount(0) 72 , m_outdatedAnimationCount(0)
73 , m_playbackRate(1) 73 , m_playbackRate(1)
74 , m_lastCurrentTimeInternal(0) 74 , m_lastCurrentTimeInternal(0)
75 { 75 {
76 ThreadState::current()->registerPreFinalizer(this);
77 if (!timing) 76 if (!timing)
78 m_timing = new AnimationTimelineTiming(this); 77 m_timing = new AnimationTimelineTiming(this);
79 else 78 else
80 m_timing = timing; 79 m_timing = timing;
81 80
82 if (Platform::current()->isThreadedAnimationEnabled()) 81 if (Platform::current()->isThreadedAnimationEnabled())
83 m_compositorTimeline = CompositorAnimationTimeline::create(); 82 m_compositorTimeline = CompositorAnimationTimeline::create();
84 83
85 ASSERT(document); 84 ASSERT(document);
86 } 85 }
87 86
88 AnimationTimeline::~AnimationTimeline()
89 {
90 }
91
92 void AnimationTimeline::dispose()
93 {
94 // The Animation objects depend on using this AnimationTimeline to
95 // unregister from its underlying compositor timeline. To arrange
96 // for that safely, this dispose() method will return first
97 // during prefinalization, notifying each Animation object of
98 // impending destruction.
99 for (const auto& animation : m_animations)
100 animation->dispose();
101 }
102
103 bool AnimationTimeline::isActive() 87 bool AnimationTimeline::isActive()
104 { 88 {
105 return m_document && m_document->page(); 89 return m_document && m_document->page();
106 } 90 }
107 91
108 void AnimationTimeline::animationAttached(Animation& animation) 92 void AnimationTimeline::animationAttached(Animation& animation)
109 { 93 {
110 ASSERT(animation.timeline() == this); 94 ASSERT(animation.timeline() == this);
111 ASSERT(!m_animations.contains(&animation)); 95 ASSERT(!m_animations.contains(&animation));
112 m_animations.add(&animation); 96 m_animations.add(&animation);
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 339
356 DEFINE_TRACE(AnimationTimeline) 340 DEFINE_TRACE(AnimationTimeline)
357 { 341 {
358 visitor->trace(m_document); 342 visitor->trace(m_document);
359 visitor->trace(m_timing); 343 visitor->trace(m_timing);
360 visitor->trace(m_animationsNeedingUpdate); 344 visitor->trace(m_animationsNeedingUpdate);
361 visitor->trace(m_animations); 345 visitor->trace(m_animations);
362 } 346 }
363 347
364 } // namespace blink 348 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/AnimationTimeline.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698