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

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

Issue 1207613004: Fix leaking AXNodeObjects when sub document detaches (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 5 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/accessibility/AXARIAGrid.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) 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 r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2230 if (frameHost()) 2230 if (frameHost())
2231 frameHost()->chromeClient().focusedNodeChanged(oldFocusedElement.get (), nullptr); 2231 frameHost()->chromeClient().focusedNodeChanged(oldFocusedElement.get (), nullptr);
2232 } 2232 }
2233 2233
2234 if (this == &axObjectCacheOwner()) 2234 if (this == &axObjectCacheOwner())
2235 clearAXObjectCache(); 2235 clearAXObjectCache();
2236 2236
2237 m_layoutView = nullptr; 2237 m_layoutView = nullptr;
2238 ContainerNode::detach(context); 2238 ContainerNode::detach(context);
2239 2239
2240 if (this != &axObjectCacheOwner()) {
2241 if (AXObjectCache* cache = existingAXObjectCache()) {
2242 // Documents that are not a root document use the AXObjectCache in
2243 // their root document. Node::removedFrom is called after the
2244 // document has been detached so it can't find the root document.
2245 // We do the removals here instead.
2246 for (Node& node : NodeTraversal::descendantsOf(*this)) {
2247 cache->remove(&node);
2248 }
2249 }
2250 }
2251
2240 styleEngine().didDetach(); 2252 styleEngine().didDetach();
2241 2253
2242 frameHost()->eventHandlerRegistry().documentDetached(*this); 2254 frameHost()->eventHandlerRegistry().documentDetached(*this);
2243 2255
2244 m_frame->inputMethodController().documentDetached(); 2256 m_frame->inputMethodController().documentDetached();
2245 2257
2246 // If this Document is associated with a live DocumentLoader, the 2258 // If this Document is associated with a live DocumentLoader, the
2247 // DocumentLoader will take care of clearing the FetchContext. Deferring 2259 // DocumentLoader will take care of clearing the FetchContext. Deferring
2248 // to the DocumentLoader when possible also prevents prematurely clearing 2260 // to the DocumentLoader when possible also prevents prematurely clearing
2249 // the context in the case where multiple Documents end up associated with 2261 // the context in the case where multiple Documents end up associated with
(...skipping 3572 matching lines...) Expand 10 before | Expand all | Expand 10 after
5822 #ifndef NDEBUG 5834 #ifndef NDEBUG
5823 using namespace blink; 5835 using namespace blink;
5824 void showLiveDocumentInstances() 5836 void showLiveDocumentInstances()
5825 { 5837 {
5826 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5838 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5827 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5839 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5828 for (Document* document : set) 5840 for (Document* document : set)
5829 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5841 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5830 } 5842 }
5831 #endif 5843 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/accessibility/AXARIAGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698