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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2366253002: Remove ActiveDOMObject::stop() (Closed)
Patch Set: temp Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 2264 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 // to trigger navigation here. However, plugins (see below) can cause lots of 2275 // to trigger navigation here. However, plugins (see below) can cause lots of
2276 // crazy things to happen, since plugin detach involves nested message loops. 2276 // crazy things to happen, since plugin detach involves nested message loops.
2277 FrameNavigationDisabler navigationDisabler(*m_frame); 2277 FrameNavigationDisabler navigationDisabler(*m_frame);
2278 // Defer widget updates to avoid plugins trying to run script inside 2278 // Defer widget updates to avoid plugins trying to run script inside
2279 // ScriptForbiddenScope, which will crash the renderer after 2279 // ScriptForbiddenScope, which will crash the renderer after
2280 // https://crrev.com/200984 2280 // https://crrev.com/200984
2281 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; 2281 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates;
2282 // Don't allow script to run in the middle of detachLayoutTree() because a 2282 // Don't allow script to run in the middle of detachLayoutTree() because a
2283 // detaching Document is not in a consistent state. 2283 // detaching Document is not in a consistent state.
2284 ScriptForbiddenScope forbidScript; 2284 ScriptForbiddenScope forbidScript;
2285
2285 view()->dispose(); 2286 view()->dispose();
2286 m_markers->prepareForDestruction(); 2287 m_markers->prepareForDestruction();
2287 2288
2288 m_lifecycle.advanceTo(DocumentLifecycle::Stopping); 2289 m_lifecycle.advanceTo(DocumentLifecycle::Stopping);
2289 2290
2290 if (page()) 2291 if (page())
2291 page()->documentDetached(this); 2292 page()->documentDetached(this);
2292 InspectorInstrumentation::documentDetached(this); 2293 InspectorInstrumentation::documentDetached(this);
2293 2294
2294 if (m_frame->loader().client()->sharedWorkerRepositoryClient()) 2295 if (m_frame->loader().client()->sharedWorkerRepositoryClient())
2295 m_frame->loader() 2296 m_frame->loader()
2296 .client() 2297 .client()
2297 ->sharedWorkerRepositoryClient() 2298 ->sharedWorkerRepositoryClient()
2298 ->documentDetached(this); 2299 ->documentDetached(this);
2299 2300
2300 stopActiveDOMObjects();
2301
2302 // FIXME: consider using ActiveDOMObject. 2301 // FIXME: consider using ActiveDOMObject.
2303 if (m_scriptedAnimationController) 2302 if (m_scriptedAnimationController)
2304 m_scriptedAnimationController->clearDocumentPointer(); 2303 m_scriptedAnimationController->clearDocumentPointer();
2305 m_scriptedAnimationController.clear(); 2304 m_scriptedAnimationController.clear();
2306 2305
2307 m_scriptedIdleTaskController.clear(); 2306 m_scriptedIdleTaskController.clear();
2308 2307
2309 if (svgExtensions()) 2308 if (svgExtensions())
2310 accessSVGExtensions().pauseAnimations(); 2309 accessSVGExtensions().pauseAnimations();
2311 2310
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 ->currentThread() 2376 ->currentThread()
2378 ->scheduler() 2377 ->scheduler()
2379 ->timerTaskRunner() 2378 ->timerTaskRunner()
2380 ->clone()); 2379 ->clone());
2381 2380
2382 if (m_mediaQueryMatcher) 2381 if (m_mediaQueryMatcher)
2383 m_mediaQueryMatcher->documentDetached(); 2382 m_mediaQueryMatcher->documentDetached();
2384 2383
2385 m_lifecycle.advanceTo(DocumentLifecycle::Stopped); 2384 m_lifecycle.advanceTo(DocumentLifecycle::Stopped);
2386 2385
2387 // FIXME: Currently we call notifyContextDestroyed() only in 2386 // TODO(haraken): Call contextDestroyed() before we start any disruptive
2387 // operations.
2388 // TODO(haraken): Currently we call notifyContextDestroyed() only in
2388 // Document::detachLayoutTree(), which means that we don't call 2389 // Document::detachLayoutTree(), which means that we don't call
2389 // notifyContextDestroyed() for a document that doesn't get detached. 2390 // notifyContextDestroyed() for a document that doesn't get detached.
2390 // If such a document has any observer, the observer won't get 2391 // If such a document has any observer, the observer won't get
2391 // a contextDestroyed() notification. This can happen for a document 2392 // a contextDestroyed() notification. This can happen for a document
2392 // created by DOMImplementation::createDocument(). 2393 // created by DOMImplementation::createDocument().
2393 ExecutionContext::notifyContextDestroyed(); 2394 ExecutionContext::notifyContextDestroyed();
2394 2395
2395 // This is required, as our LocalFrame might delete itself as soon as it 2396 // This is required, as our LocalFrame might delete itself as soon as it detac hes
2396 // detaches us. However, this violates Node::detachLayoutTree() semantics, as 2397 // us. However, this violates Node::detachLayoutTree() semantics, as it's neve r
2397 // it's never possible to re-attach. Eventually Document::detachLayoutTree() 2398 // possible to re-attach. Eventually Document::detachLayoutTree() should be re named,
2398 // should be renamed, or this setting of the frame to 0 could be made explicit 2399 // or this setting of the frame to 0 could be made explicit in each of the
2399 // in each of the callers of Document::detachLayoutTree(). 2400 // callers of Document::detachLayoutTree().
2400 m_frame = nullptr; 2401 m_frame = nullptr;
2401 } 2402 }
2402 2403
2403 void Document::removeAllEventListeners() { 2404 void Document::removeAllEventListeners() {
2404 ContainerNode::removeAllEventListeners(); 2405 ContainerNode::removeAllEventListeners();
2405 2406
2406 if (LocalDOMWindow* domWindow = this->domWindow()) 2407 if (LocalDOMWindow* domWindow = this->domWindow())
2407 domWindow->removeAllEventListeners(); 2408 domWindow->removeAllEventListeners();
2408 } 2409 }
2409 2410
(...skipping 3959 matching lines...) Expand 10 before | Expand all | Expand 10 after
6369 } 6370 }
6370 6371
6371 void showLiveDocumentInstances() { 6372 void showLiveDocumentInstances() {
6372 WeakDocumentSet& set = liveDocumentSet(); 6373 WeakDocumentSet& set = liveDocumentSet();
6373 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6374 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6374 for (Document* document : set) 6375 for (Document* document : set)
6375 fprintf(stderr, "- Document %p URL: %s\n", document, 6376 fprintf(stderr, "- Document %p URL: %s\n", document,
6376 document->url().getString().utf8().data()); 6377 document->url().getString().utf8().data());
6377 } 6378 }
6378 #endif 6379 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698