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

Unified Diff: Source/WebCore/dom/ScriptedAnimationController.cpp

Issue 8894015: Merge 102405 - Source/WebCore: Improve handling of frame removal during requestAnimationFrame cal... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/912/
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/dom/ScriptedAnimationController.h ('k') | Source/WebCore/page/FrameView.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/dom/ScriptedAnimationController.cpp
===================================================================
--- Source/WebCore/dom/ScriptedAnimationController.cpp (revision 102462)
+++ Source/WebCore/dom/ScriptedAnimationController.cpp (working copy)
@@ -61,6 +61,10 @@
windowScreenDidChange(displayID);
}
+ScriptedAnimationController::~ScriptedAnimationController()
+{
+}
+
void ScriptedAnimationController::suspend()
{
++m_suspendCount;
@@ -119,8 +123,17 @@
// missing any callbacks, we keep iterating through the list of candiate callbacks and firing
// them until nothing new becomes visible.
bool firedCallback;
+
+ // Invoking callbacks may detach elements from our document, which clear's the document's
+ // reference to us, so take a defensive reference.
+ RefPtr<ScriptedAnimationController> protector(this);
do {
firedCallback = false;
+ // A previous iteration may have detached this Document from the DOM tree.
+ // If so, then we do not need to process any more callbacks.
+ if (!m_document)
+ continue;
+
// A previous iteration may have invalidated style (or layout). Update styles for each iteration
// for now since all we check is the existence of a renderer.
m_document->updateStyleIfNeeded();
@@ -161,6 +174,9 @@
void ScriptedAnimationController::scheduleAnimation()
{
+ if (!m_document)
+ return;
+
#if USE(REQUEST_ANIMATION_FRAME_TIMER)
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
if (!m_useTimer) {
« no previous file with comments | « Source/WebCore/dom/ScriptedAnimationController.h ('k') | Source/WebCore/page/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698