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

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

Issue 1081673003: Oilpan: Prepare to move AXObjectCache to the heap (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Element.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 2236 matching lines...) Expand 10 before | Expand all | Expand 10 after
2247 return top.frame()->pagePopupOwner()->document().axObjectCacheOwner(); 2247 return top.frame()->pagePopupOwner()->document().axObjectCacheOwner();
2248 } 2248 }
2249 return top; 2249 return top;
2250 } 2250 }
2251 2251
2252 void Document::clearAXObjectCache() 2252 void Document::clearAXObjectCache()
2253 { 2253 {
2254 ASSERT(&axObjectCacheOwner() == this); 2254 ASSERT(&axObjectCacheOwner() == this);
2255 // Clear the cache member variable before calling delete because attempts 2255 // Clear the cache member variable before calling delete because attempts
2256 // are made to access it during destruction. 2256 // are made to access it during destruction.
2257 if (m_axObjectCache)
2258 m_axObjectCache->dispose();
2257 m_axObjectCache.clear(); 2259 m_axObjectCache.clear();
2258 } 2260 }
2259 2261
2260 AXObjectCache* Document::existingAXObjectCache() const 2262 AXObjectCache* Document::existingAXObjectCache() const
2261 { 2263 {
2262 // If the layoutObject is gone then we are in the process of destruction. 2264 // If the layoutObject is gone then we are in the process of destruction.
2263 // This method will be called before m_frame = nullptr. 2265 // This method will be called before m_frame = nullptr.
2264 if (!axObjectCacheOwner().layoutView()) 2266 if (!axObjectCacheOwner().layoutView())
2265 return 0; 2267 return 0;
2266 2268
(...skipping 11 matching lines...) Expand all
2278 // to any other WebCoreAXObject on the same page. Using a single cache allo ws 2280 // to any other WebCoreAXObject on the same page. Using a single cache allo ws
2279 // lookups across nested webareas (i.e. multiple documents). 2281 // lookups across nested webareas (i.e. multiple documents).
2280 Document& cacheOwner = this->axObjectCacheOwner(); 2282 Document& cacheOwner = this->axObjectCacheOwner();
2281 2283
2282 // If the document has already been detached, do not make a new axObjectCach e. 2284 // If the document has already been detached, do not make a new axObjectCach e.
2283 if (!cacheOwner.layoutView()) 2285 if (!cacheOwner.layoutView())
2284 return 0; 2286 return 0;
2285 2287
2286 ASSERT(&cacheOwner == this || !m_axObjectCache); 2288 ASSERT(&cacheOwner == this || !m_axObjectCache);
2287 if (!cacheOwner.m_axObjectCache) 2289 if (!cacheOwner.m_axObjectCache)
2288 cacheOwner.m_axObjectCache = adoptPtr(AXObjectCache::create(cacheOwner)) ; 2290 cacheOwner.m_axObjectCache = AXObjectCache::create(cacheOwner);
2289 return cacheOwner.m_axObjectCache.get(); 2291 return cacheOwner.m_axObjectCache.get();
2290 } 2292 }
2291 2293
2292 PassRefPtrWillBeRawPtr<DocumentParser> Document::createParser() 2294 PassRefPtrWillBeRawPtr<DocumentParser> Document::createParser()
2293 { 2295 {
2294 if (isHTMLDocument()) { 2296 if (isHTMLDocument()) {
2295 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors( this); 2297 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors( this);
2296 return HTMLDocumentParser::create(toHTMLDocument(*this), reportErrors, m _parserSyncPolicy); 2298 return HTMLDocumentParser::create(toHTMLDocument(*this), reportErrors, m _parserSyncPolicy);
2297 } 2299 }
2298 // FIXME: this should probably pass the frame instead 2300 // FIXME: this should probably pass the frame instead
(...skipping 3323 matching lines...) Expand 10 before | Expand all | Expand 10 after
5622 } 5624 }
5623 5625
5624 void Document::platformColorsChanged() 5626 void Document::platformColorsChanged()
5625 { 5627 {
5626 if (!isActive()) 5628 if (!isActive())
5627 return; 5629 return;
5628 5630
5629 styleEngine().platformColorsChanged(); 5631 styleEngine().platformColorsChanged();
5630 } 5632 }
5631 5633
5632 void Document::clearWeakMembers(Visitor* visitor)
5633 {
5634 if (m_axObjectCache)
5635 m_axObjectCache->clearWeakMembers(visitor);
5636 }
5637
5638 v8::Local<v8::Object> Document::wrap(v8::Isolate* isolate, v8::Local<v8::Object> creationContext) 5634 v8::Local<v8::Object> Document::wrap(v8::Isolate* isolate, v8::Local<v8::Object> creationContext)
5639 { 5635 {
5640 // It's possible that no one except for the new wrapper owns this object at 5636 // It's possible that no one except for the new wrapper owns this object at
5641 // this moment, so we have to prevent GC to collect this object until the 5637 // this moment, so we have to prevent GC to collect this object until the
5642 // object gets associated with the wrapper. 5638 // object gets associated with the wrapper.
5643 RefPtrWillBeRawPtr<Document> protect(this); 5639 RefPtrWillBeRawPtr<Document> protect(this);
5644 5640
5645 ASSERT(!DOMDataStore::containsWrapper(this, isolate)); 5641 ASSERT(!DOMDataStore::containsWrapper(this, isolate));
5646 5642
5647 const WrapperTypeInfo* wrapperType = wrapperTypeInfo(); 5643 const WrapperTypeInfo* wrapperType = wrapperTypeInfo();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
5706 #if ENABLE(OILPAN) 5702 #if ENABLE(OILPAN)
5707 visitor->trace(m_importsController); 5703 visitor->trace(m_importsController);
5708 visitor->trace(m_docType); 5704 visitor->trace(m_docType);
5709 visitor->trace(m_implementation); 5705 visitor->trace(m_implementation);
5710 visitor->trace(m_autofocusElement); 5706 visitor->trace(m_autofocusElement);
5711 visitor->trace(m_focusedElement); 5707 visitor->trace(m_focusedElement);
5712 visitor->trace(m_hoverNode); 5708 visitor->trace(m_hoverNode);
5713 visitor->trace(m_activeHoverElement); 5709 visitor->trace(m_activeHoverElement);
5714 visitor->trace(m_documentElement); 5710 visitor->trace(m_documentElement);
5715 visitor->trace(m_titleElement); 5711 visitor->trace(m_titleElement);
5712 visitor->trace(m_axObjectCache);
5716 visitor->trace(m_markers); 5713 visitor->trace(m_markers);
5717 visitor->trace(m_cssTarget); 5714 visitor->trace(m_cssTarget);
5718 visitor->trace(m_currentScriptStack); 5715 visitor->trace(m_currentScriptStack);
5719 visitor->trace(m_scriptRunner); 5716 visitor->trace(m_scriptRunner);
5720 visitor->trace(m_listsInvalidatedAtDocument); 5717 visitor->trace(m_listsInvalidatedAtDocument);
5721 for (int i = 0; i < numNodeListInvalidationTypes; ++i) 5718 for (int i = 0; i < numNodeListInvalidationTypes; ++i)
5722 visitor->trace(m_nodeLists[i]); 5719 visitor->trace(m_nodeLists[i]);
5723 visitor->trace(m_cssCanvasElements); 5720 visitor->trace(m_cssCanvasElements);
5724 visitor->trace(m_topLayerElements); 5721 visitor->trace(m_topLayerElements);
5725 visitor->trace(m_elemSheet); 5722 visitor->trace(m_elemSheet);
(...skipping 19 matching lines...) Expand all
5745 visitor->trace(m_layerUpdateSVGFilterElements); 5742 visitor->trace(m_layerUpdateSVGFilterElements);
5746 visitor->trace(m_timers); 5743 visitor->trace(m_timers);
5747 visitor->trace(m_templateDocument); 5744 visitor->trace(m_templateDocument);
5748 visitor->trace(m_templateDocumentHost); 5745 visitor->trace(m_templateDocumentHost);
5749 visitor->trace(m_visibilityObservers); 5746 visitor->trace(m_visibilityObservers);
5750 visitor->trace(m_userActionElements); 5747 visitor->trace(m_userActionElements);
5751 visitor->trace(m_svgExtensions); 5748 visitor->trace(m_svgExtensions);
5752 visitor->trace(m_timeline); 5749 visitor->trace(m_timeline);
5753 visitor->trace(m_compositorPendingAnimations); 5750 visitor->trace(m_compositorPendingAnimations);
5754 visitor->trace(m_contextDocument); 5751 visitor->trace(m_contextDocument);
5755 visitor->template registerWeakMembers<Document, &Document::clearWeakMembers> (this);
5756 WillBeHeapSupplementable<Document>::trace(visitor); 5752 WillBeHeapSupplementable<Document>::trace(visitor);
5757 #endif 5753 #endif
5758 TreeScope::trace(visitor); 5754 TreeScope::trace(visitor);
5759 ContainerNode::trace(visitor); 5755 ContainerNode::trace(visitor);
5760 ExecutionContext::trace(visitor); 5756 ExecutionContext::trace(visitor);
5761 DocumentLifecycleNotifier::trace(visitor); 5757 DocumentLifecycleNotifier::trace(visitor);
5762 } 5758 }
5763 5759
5764 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>; 5760 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>;
5765 5761
5766 } // namespace blink 5762 } // namespace blink
5767 5763
5768 #ifndef NDEBUG 5764 #ifndef NDEBUG
5769 using namespace blink; 5765 using namespace blink;
5770 void showLiveDocumentInstances() 5766 void showLiveDocumentInstances()
5771 { 5767 {
5772 WeakDocumentSet& set = liveDocumentSet(); 5768 WeakDocumentSet& set = liveDocumentSet();
5773 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5769 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5774 for (Document* document : set) 5770 for (Document* document : set)
5775 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5771 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5776 } 5772 }
5777 #endif 5773 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698