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

Unified Diff: Source/core/svg/graphics/SVGImageChromeClient.cpp

Issue 891263003: Keep SVGImage alive across its animation timer callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: a stack protection is required here Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/graphics/SVGImageChromeClient.cpp
diff --git a/Source/core/svg/graphics/SVGImageChromeClient.cpp b/Source/core/svg/graphics/SVGImageChromeClient.cpp
index 331860cd6e53373c47b0b837ab9add0d040826f2..303d554f7e83ec64f39b7bbb8b5ca130af31df00 100644
--- a/Source/core/svg/graphics/SVGImageChromeClient.cpp
+++ b/Source/core/svg/graphics/SVGImageChromeClient.cpp
@@ -86,8 +86,22 @@ void SVGImageChromeClient::animationTimerFired(Timer<SVGImageChromeClient>*)
// serviceScriptedAnimations runs requestAnimationFrame callbacks, but SVG
// images can't have any so we assert there's no script.
ScriptForbiddenScope forbidScript;
+
+ // As neither SVGImage nor this chrome client object are on the Oilpan heap,
+ // this object's reference to the SVGImage will not be traced should a GC
+ // strike below. Hence, we must ensure that they both remain alive for
+ // duration of this call.
+ //
+ // This is cannot arise non-Oilpan as an ImageResource is an owned object
+ // and will be promptly released along with its (SVG)Image..and everything
+ // below, including this object and its timer. For code simplicity, the
+ // object protection isn't made the conditional on Oilpan.
+ //
+ // FIXME: Oilpan: move this and other ChromeClients to the Oilpan heap
+ // to render this protection redundant.
+ RefPtr<SVGImage> protect(m_image);
m_image->frameView()->page()->animator().serviceScriptedAnimations(monotonicallyIncreasingTime());
m_image->frameView()->updateLayoutAndStyleForPainting();
}
-}
+} // namespace blink
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698