OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 // animations. Checking for pending/active animations could be more | 80 // animations. Checking for pending/active animations could be more |
81 // stringent. | 81 // stringent. |
82 double fireTime = m_image->hasAnimations() ? animationFrameDelay : 0; | 82 double fireTime = m_image->hasAnimations() ? animationFrameDelay : 0; |
83 m_animationTimer.startOneShot(fireTime, BLINK_FROM_HERE); | 83 m_animationTimer.startOneShot(fireTime, BLINK_FROM_HERE); |
84 } | 84 } |
85 | 85 |
86 void SVGImageChromeClient::animationTimerFired(Timer<SVGImageChromeClient>*) | 86 void SVGImageChromeClient::animationTimerFired(Timer<SVGImageChromeClient>*) |
87 { | 87 { |
88 if (!m_image) | 88 if (!m_image) |
89 return; | 89 return; |
90 | |
91 #if ENABLE(OILPAN) | |
92 // The SVGImageChromeClient object's lifetime is dependent on | |
93 // the ImageObserver (an ImageResource) of its image. Should it | |
94 // be dead and about to be lazily swept out, do not proceed. | |
95 // | |
96 // TODO(Oilpan): move (SVG)Image to the Oilpan heap, and avoid | |
97 // this explicit lifetime check. | |
98 if (Heap::willObjectBeLazilySwept(m_image->imageObserver())) | |
haraken
2016/02/11 13:25:19
Can we avoid using Heap::willObjectBeLazilySwept b
sof
2016/02/11 13:27:41
ImageLoader already is, so it gets complex if Imag
haraken
2016/02/11 13:49:40
Would it be possible to make SVGImageChromeClient
| |
99 return; | |
100 #endif | |
101 | |
90 // serviceScriptedAnimations runs requestAnimationFrame callbacks, but SVG | 102 // serviceScriptedAnimations runs requestAnimationFrame callbacks, but SVG |
91 // images can't have any so we assert there's no script. | 103 // images can't have any so we assert there's no script. |
92 ScriptForbiddenScope forbidScript; | 104 ScriptForbiddenScope forbidScript; |
93 | 105 |
94 // As neither SVGImage nor this chrome client object are on the Oilpan heap, | 106 // The calls below may trigger GCs, so set up the required persistent |
95 // this object's reference to the SVGImage will not be traced should a GC | 107 // reference on the ImageResource which owns this SVGImage. By transitivity, |
96 // strike below. Hence, we must ensure that they both remain alive for | 108 // that will keep this SVGImageChromeClient object alive. |
97 // duration of this call. | 109 RawPtrWillBePersistent<ImageObserver> protect(m_image->imageObserver()); |
98 // | |
99 // This is cannot arise non-Oilpan as an ImageResource is an owned object | |
100 // and will be promptly released along with its (SVG)Image..and everything | |
101 // below, including this object and its timer. For code simplicity, the | |
102 // object protection isn't made the conditional on Oilpan. | |
103 // | |
104 // TODO(oilpan): move SVGImage to the Oilpan heap and remove this protection . | |
105 RefPtr<SVGImage> protect(m_image); | |
106 m_image->frameView()->page()->animator().serviceScriptedAnimations(monotonic allyIncreasingTime()); | 110 m_image->frameView()->page()->animator().serviceScriptedAnimations(monotonic allyIncreasingTime()); |
107 m_image->frameView()->updateAllLifecyclePhases(); | 111 m_image->frameView()->updateAllLifecyclePhases(); |
108 } | 112 } |
109 | 113 |
110 } // namespace blink | 114 } // namespace blink |
OLD | NEW |