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

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

Issue 1072273006: Oilpan: Prepare moving AXObject to heap (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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 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 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after
2200 if (top.frame() && top.frame()->pagePopupOwner()) { 2200 if (top.frame() && top.frame()->pagePopupOwner()) {
2201 ASSERT(!top.m_axObjectCache); 2201 ASSERT(!top.m_axObjectCache);
2202 return top.frame()->pagePopupOwner()->document().axObjectCacheOwner(); 2202 return top.frame()->pagePopupOwner()->document().axObjectCacheOwner();
2203 } 2203 }
2204 return top; 2204 return top;
2205 } 2205 }
2206 2206
2207 void Document::clearAXObjectCache() 2207 void Document::clearAXObjectCache()
2208 { 2208 {
2209 ASSERT(&axObjectCacheOwner() == this); 2209 ASSERT(&axObjectCacheOwner() == this);
2210 // Clear the cache member variable before calling delete because attempts 2210 // Clear the cache member variable before calling discard because attempts
2211 // are made to access it during destruction. 2211 // are made to access it during discard.
2212 m_axObjectCache.clear(); 2212 OwnPtrWillBeRawPtr<AXObjectCache> cache = m_axObjectCache.release();
2213 if (cache)
2214 cache->dispose();
2213 } 2215 }
2214 2216
2215 AXObjectCache* Document::existingAXObjectCache() const 2217 AXObjectCache* Document::existingAXObjectCache() const
2216 { 2218 {
2217 // If the renderer is gone then we are in the process of destruction. 2219 // If the renderer is gone then we are in the process of destruction.
2218 // This method will be called before m_frame = nullptr. 2220 // This method will be called before m_frame = nullptr.
2219 if (!axObjectCacheOwner().layoutView()) 2221 if (!axObjectCacheOwner().layoutView())
2220 return 0; 2222 return 0;
2221 2223
2222 return axObjectCacheOwner().m_axObjectCache.get(); 2224 return axObjectCacheOwner().m_axObjectCache.get();
(...skipping 10 matching lines...) Expand all
2233 // to any other WebCoreAXObject on the same page. Using a single cache allo ws 2235 // to any other WebCoreAXObject on the same page. Using a single cache allo ws
2234 // lookups across nested webareas (i.e. multiple documents). 2236 // lookups across nested webareas (i.e. multiple documents).
2235 Document& cacheOwner = this->axObjectCacheOwner(); 2237 Document& cacheOwner = this->axObjectCacheOwner();
2236 2238
2237 // If the document has already been detached, do not make a new axObjectCach e. 2239 // If the document has already been detached, do not make a new axObjectCach e.
2238 if (!cacheOwner.layoutView()) 2240 if (!cacheOwner.layoutView())
2239 return 0; 2241 return 0;
2240 2242
2241 ASSERT(&cacheOwner == this || !m_axObjectCache); 2243 ASSERT(&cacheOwner == this || !m_axObjectCache);
2242 if (!cacheOwner.m_axObjectCache) 2244 if (!cacheOwner.m_axObjectCache)
2243 cacheOwner.m_axObjectCache = adoptPtr(AXObjectCache::create(cacheOwner)) ; 2245 cacheOwner.m_axObjectCache = AXObjectCache::create(cacheOwner);
2244 return cacheOwner.m_axObjectCache.get(); 2246 return cacheOwner.m_axObjectCache.get();
2245 } 2247 }
2246 2248
2247 PassRefPtrWillBeRawPtr<DocumentParser> Document::createParser() 2249 PassRefPtrWillBeRawPtr<DocumentParser> Document::createParser()
2248 { 2250 {
2249 if (isHTMLDocument()) { 2251 if (isHTMLDocument()) {
2250 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors( this); 2252 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors( this);
2251 return HTMLDocumentParser::create(toHTMLDocument(*this), reportErrors, m _parserSyncPolicy); 2253 return HTMLDocumentParser::create(toHTMLDocument(*this), reportErrors, m _parserSyncPolicy);
2252 } 2254 }
2253 // FIXME: this should probably pass the frame instead 2255 // FIXME: this should probably pass the frame instead
(...skipping 3444 matching lines...) Expand 10 before | Expand all | Expand 10 after
5698 #if ENABLE(OILPAN) 5700 #if ENABLE(OILPAN)
5699 visitor->trace(m_importsController); 5701 visitor->trace(m_importsController);
5700 visitor->trace(m_docType); 5702 visitor->trace(m_docType);
5701 visitor->trace(m_implementation); 5703 visitor->trace(m_implementation);
5702 visitor->trace(m_autofocusElement); 5704 visitor->trace(m_autofocusElement);
5703 visitor->trace(m_focusedElement); 5705 visitor->trace(m_focusedElement);
5704 visitor->trace(m_hoverNode); 5706 visitor->trace(m_hoverNode);
5705 visitor->trace(m_activeHoverElement); 5707 visitor->trace(m_activeHoverElement);
5706 visitor->trace(m_documentElement); 5708 visitor->trace(m_documentElement);
5707 visitor->trace(m_titleElement); 5709 visitor->trace(m_titleElement);
5710 visitor->trace(m_axObjectCache);
5708 visitor->trace(m_markers); 5711 visitor->trace(m_markers);
5709 visitor->trace(m_cssTarget); 5712 visitor->trace(m_cssTarget);
5710 visitor->trace(m_currentScriptStack); 5713 visitor->trace(m_currentScriptStack);
5711 visitor->trace(m_scriptRunner); 5714 visitor->trace(m_scriptRunner);
5712 visitor->trace(m_listsInvalidatedAtDocument); 5715 visitor->trace(m_listsInvalidatedAtDocument);
5713 for (int i = 0; i < numNodeListInvalidationTypes; ++i) 5716 for (int i = 0; i < numNodeListInvalidationTypes; ++i)
5714 visitor->trace(m_nodeLists[i]); 5717 visitor->trace(m_nodeLists[i]);
5715 visitor->trace(m_cssCanvasElements); 5718 visitor->trace(m_cssCanvasElements);
5716 visitor->trace(m_topLayerElements); 5719 visitor->trace(m_topLayerElements);
5717 visitor->trace(m_elemSheet); 5720 visitor->trace(m_elemSheet);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
5760 #ifndef NDEBUG 5763 #ifndef NDEBUG
5761 using namespace blink; 5764 using namespace blink;
5762 void showLiveDocumentInstances() 5765 void showLiveDocumentInstances()
5763 { 5766 {
5764 WeakDocumentSet& set = liveDocumentSet(); 5767 WeakDocumentSet& set = liveDocumentSet();
5765 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5768 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5766 for (Document* document : set) 5769 for (Document* document : set)
5767 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5770 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5768 } 5771 }
5769 #endif 5772 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698