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

Side by Side Diff: Source/core/animation/ElementAnimations.cpp

Issue 1322883003: Oilpan: KeyframeEffect::m_target shouldn't become stale (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/animation/ElementAnimations.h ('k') | Source/core/animation/KeyframeEffect.cpp » ('j') | 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 24 matching lines...) Expand all
35 35
36 namespace blink { 36 namespace blink {
37 37
38 ElementAnimations::ElementAnimations() 38 ElementAnimations::ElementAnimations()
39 : m_animationStyleChange(false) 39 : m_animationStyleChange(false)
40 { 40 {
41 } 41 }
42 42
43 ElementAnimations::~ElementAnimations() 43 ElementAnimations::~ElementAnimations()
44 { 44 {
45 #if !ENABLE(OILPAN)
46 ASSERT(m_effects.isEmpty());
47 #endif
45 } 48 }
46 49
50 #if !ENABLE(OILPAN)
51 void ElementAnimations::dispose()
52 {
53 // The notifyElementDestroyed() is called for elements that happen to live
54 // longer than the KeyframeEffect. This undeterminism is fine because
55 // all the notifyElementDestroyed() does is to clear the raw pointers
56 // held by the KeyframeEffect.
57 for (KeyframeEffect* effect : m_effects)
58 effect->notifyElementDestroyed();
59 m_effects.clear();
60 }
61 #endif
62
47 void ElementAnimations::updateAnimationFlags(ComputedStyle& style) 63 void ElementAnimations::updateAnimationFlags(ComputedStyle& style)
48 { 64 {
49 for (const auto& entry : m_animations) { 65 for (const auto& entry : m_animations) {
50 const Animation& animation = *entry.key; 66 const Animation& animation = *entry.key;
51 ASSERT(animation.effect()); 67 ASSERT(animation.effect());
52 // FIXME: Needs to consider AnimationGroup once added. 68 // FIXME: Needs to consider AnimationGroup once added.
53 ASSERT(animation.effect()->isKeyframeEffect()); 69 ASSERT(animation.effect()->isKeyframeEffect());
54 const KeyframeEffect& effect = *toKeyframeEffect(animation.effect()); 70 const KeyframeEffect& effect = *toKeyframeEffect(animation.effect());
55 if (effect.isCurrent()) { 71 if (effect.isCurrent()) {
56 if (effect.affects(PropertyHandle(CSSPropertyOpacity))) 72 if (effect.affects(PropertyHandle(CSSPropertyOpacity)))
(...skipping 24 matching lines...) Expand all
81 { 97 {
82 for (const auto& entry : m_animations) 98 for (const auto& entry : m_animations)
83 entry.key->restartAnimationOnCompositor(); 99 entry.key->restartAnimationOnCompositor();
84 } 100 }
85 101
86 DEFINE_TRACE(ElementAnimations) 102 DEFINE_TRACE(ElementAnimations)
87 { 103 {
88 visitor->trace(m_cssAnimations); 104 visitor->trace(m_cssAnimations);
89 visitor->trace(m_defaultStack); 105 visitor->trace(m_defaultStack);
90 visitor->trace(m_animations); 106 visitor->trace(m_animations);
107 #if !ENABLE(OILPAN)
108 visitor->trace(m_effects);
109 #endif
91 } 110 }
92 111
93 const ComputedStyle* ElementAnimations::baseComputedStyle() const 112 const ComputedStyle* ElementAnimations::baseComputedStyle() const
94 { 113 {
95 #if !ENABLE(ASSERT) 114 #if !ENABLE(ASSERT)
96 if (isAnimationStyleChange()) 115 if (isAnimationStyleChange())
97 return m_baseComputedStyle.get(); 116 return m_baseComputedStyle.get();
98 #endif 117 #endif
99 return nullptr; 118 return nullptr;
100 } 119 }
(...skipping 21 matching lines...) Expand all
122 // TODO(rune@opera.com): The FontFaceCache version number may be increased w ithout forcing 141 // TODO(rune@opera.com): The FontFaceCache version number may be increased w ithout forcing
123 // a style recalc (see crbug.com/471079). ComputedStyle objects created with different cache 142 // a style recalc (see crbug.com/471079). ComputedStyle objects created with different cache
124 // versions will not be considered equal as Font::operator== will compare ve rsions, hence 143 // versions will not be considered equal as Font::operator== will compare ve rsions, hence
125 // ComputedStyle::operator== will return false. We avoid using baseComputedS tyle (the check for 144 // ComputedStyle::operator== will return false. We avoid using baseComputedS tyle (the check for
126 // isFallbackValid()) in that case to avoid triggering the ComputedStyle com parison ASSERT 145 // isFallbackValid()) in that case to avoid triggering the ComputedStyle com parison ASSERT
127 // in updateBaseComputedStyle. 146 // in updateBaseComputedStyle.
128 return m_animationStyleChange && (!m_baseComputedStyle || m_baseComputedStyl e->font().isFallbackValid()); 147 return m_animationStyleChange && (!m_baseComputedStyle || m_baseComputedStyl e->font().isFallbackValid());
129 } 148 }
130 149
131 } // namespace blink 150 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/ElementAnimations.h ('k') | Source/core/animation/KeyframeEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698