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

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
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 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2189 return top.frame()->pagePopupOwner()->document().axObjectCacheOwner(); 2189 return top.frame()->pagePopupOwner()->document().axObjectCacheOwner();
2190 } 2190 }
2191 return top; 2191 return top;
2192 } 2192 }
2193 2193
2194 void Document::clearAXObjectCache() 2194 void Document::clearAXObjectCache()
2195 { 2195 {
2196 ASSERT(&axObjectCacheOwner() == this); 2196 ASSERT(&axObjectCacheOwner() == this);
2197 // Clear the cache member variable before calling delete because attempts 2197 // Clear the cache member variable before calling delete because attempts
2198 // are made to access it during destruction. 2198 // are made to access it during destruction.
2199 if (m_axObjectCache)
2200 m_axObjectCache->dispose();
2199 m_axObjectCache.clear(); 2201 m_axObjectCache.clear();
2200 } 2202 }
2201 2203
2202 AXObjectCache* Document::existingAXObjectCache() const 2204 AXObjectCache* Document::existingAXObjectCache() const
2203 { 2205 {
2204 // If the layoutObject is gone then we are in the process of destruction. 2206 // If the layoutObject is gone then we are in the process of destruction.
2205 // This method will be called before m_frame = nullptr. 2207 // This method will be called before m_frame = nullptr.
2206 if (!axObjectCacheOwner().layoutView()) 2208 if (!axObjectCacheOwner().layoutView())
2207 return 0; 2209 return 0;
2208 2210
(...skipping 11 matching lines...) Expand all
2220 // to any other WebCoreAXObject on the same page. Using a single cache allo ws 2222 // to any other WebCoreAXObject on the same page. Using a single cache allo ws
2221 // lookups across nested webareas (i.e. multiple documents). 2223 // lookups across nested webareas (i.e. multiple documents).
2222 Document& cacheOwner = this->axObjectCacheOwner(); 2224 Document& cacheOwner = this->axObjectCacheOwner();
2223 2225
2224 // If the document has already been detached, do not make a new axObjectCach e. 2226 // If the document has already been detached, do not make a new axObjectCach e.
2225 if (!cacheOwner.layoutView()) 2227 if (!cacheOwner.layoutView())
2226 return 0; 2228 return 0;
2227 2229
2228 ASSERT(&cacheOwner == this || !m_axObjectCache); 2230 ASSERT(&cacheOwner == this || !m_axObjectCache);
2229 if (!cacheOwner.m_axObjectCache) 2231 if (!cacheOwner.m_axObjectCache)
2230 cacheOwner.m_axObjectCache = adoptPtr(AXObjectCache::create(cacheOwner)) ; 2232 cacheOwner.m_axObjectCache = AXObjectCache::create(cacheOwner);
2231 return cacheOwner.m_axObjectCache.get(); 2233 return cacheOwner.m_axObjectCache.get();
2232 } 2234 }
2233 2235
2234 PassRefPtrWillBeRawPtr<DocumentParser> Document::createParser() 2236 PassRefPtrWillBeRawPtr<DocumentParser> Document::createParser()
2235 { 2237 {
2236 if (isHTMLDocument()) { 2238 if (isHTMLDocument()) {
2237 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors( this); 2239 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors( this);
2238 return HTMLDocumentParser::create(toHTMLDocument(*this), reportErrors, m _parserSyncPolicy); 2240 return HTMLDocumentParser::create(toHTMLDocument(*this), reportErrors, m _parserSyncPolicy);
2239 } 2241 }
2240 // FIXME: this should probably pass the frame instead 2242 // FIXME: this should probably pass the frame instead
(...skipping 3293 matching lines...) Expand 10 before | Expand all | Expand 10 after
5534 } 5536 }
5535 5537
5536 void Document::platformColorsChanged() 5538 void Document::platformColorsChanged()
5537 { 5539 {
5538 if (!isActive()) 5540 if (!isActive())
5539 return; 5541 return;
5540 5542
5541 styleEngine().platformColorsChanged(); 5543 styleEngine().platformColorsChanged();
5542 } 5544 }
5543 5545
5544 void Document::clearWeakMembers(Visitor* visitor)
5545 {
5546 if (m_axObjectCache)
5547 m_axObjectCache->clearWeakMembers(visitor);
5548 }
5549
5550 v8::Local<v8::Object> Document::wrap(v8::Isolate* isolate, v8::Local<v8::Object> creationContext) 5546 v8::Local<v8::Object> Document::wrap(v8::Isolate* isolate, v8::Local<v8::Object> creationContext)
5551 { 5547 {
5552 // It's possible that no one except for the new wrapper owns this object at 5548 // It's possible that no one except for the new wrapper owns this object at
5553 // this moment, so we have to prevent GC to collect this object until the 5549 // this moment, so we have to prevent GC to collect this object until the
5554 // object gets associated with the wrapper. 5550 // object gets associated with the wrapper.
5555 RefPtrWillBeRawPtr<Document> protect(this); 5551 RefPtrWillBeRawPtr<Document> protect(this);
5556 5552
5557 ASSERT(!DOMDataStore::containsWrapper(this, isolate)); 5553 ASSERT(!DOMDataStore::containsWrapper(this, isolate));
5558 5554
5559 const WrapperTypeInfo* wrapperType = wrapperTypeInfo(); 5555 const WrapperTypeInfo* wrapperType = wrapperTypeInfo();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
5618 #if ENABLE(OILPAN) 5614 #if ENABLE(OILPAN)
5619 visitor->trace(m_importsController); 5615 visitor->trace(m_importsController);
5620 visitor->trace(m_docType); 5616 visitor->trace(m_docType);
5621 visitor->trace(m_implementation); 5617 visitor->trace(m_implementation);
5622 visitor->trace(m_autofocusElement); 5618 visitor->trace(m_autofocusElement);
5623 visitor->trace(m_focusedElement); 5619 visitor->trace(m_focusedElement);
5624 visitor->trace(m_hoverNode); 5620 visitor->trace(m_hoverNode);
5625 visitor->trace(m_activeHoverElement); 5621 visitor->trace(m_activeHoverElement);
5626 visitor->trace(m_documentElement); 5622 visitor->trace(m_documentElement);
5627 visitor->trace(m_titleElement); 5623 visitor->trace(m_titleElement);
5624 visitor->trace(m_axObjectCache);
5628 visitor->trace(m_markers); 5625 visitor->trace(m_markers);
5629 visitor->trace(m_cssTarget); 5626 visitor->trace(m_cssTarget);
5630 visitor->trace(m_currentScriptStack); 5627 visitor->trace(m_currentScriptStack);
5631 visitor->trace(m_scriptRunner); 5628 visitor->trace(m_scriptRunner);
5632 visitor->trace(m_listsInvalidatedAtDocument); 5629 visitor->trace(m_listsInvalidatedAtDocument);
5633 for (int i = 0; i < numNodeListInvalidationTypes; ++i) 5630 for (int i = 0; i < numNodeListInvalidationTypes; ++i)
5634 visitor->trace(m_nodeLists[i]); 5631 visitor->trace(m_nodeLists[i]);
5635 visitor->trace(m_cssCanvasElements); 5632 visitor->trace(m_cssCanvasElements);
5636 visitor->trace(m_topLayerElements); 5633 visitor->trace(m_topLayerElements);
5637 visitor->trace(m_elemSheet); 5634 visitor->trace(m_elemSheet);
(...skipping 19 matching lines...) Expand all
5657 visitor->trace(m_layerUpdateSVGFilterElements); 5654 visitor->trace(m_layerUpdateSVGFilterElements);
5658 visitor->trace(m_timers); 5655 visitor->trace(m_timers);
5659 visitor->trace(m_templateDocument); 5656 visitor->trace(m_templateDocument);
5660 visitor->trace(m_templateDocumentHost); 5657 visitor->trace(m_templateDocumentHost);
5661 visitor->trace(m_visibilityObservers); 5658 visitor->trace(m_visibilityObservers);
5662 visitor->trace(m_userActionElements); 5659 visitor->trace(m_userActionElements);
5663 visitor->trace(m_svgExtensions); 5660 visitor->trace(m_svgExtensions);
5664 visitor->trace(m_timeline); 5661 visitor->trace(m_timeline);
5665 visitor->trace(m_compositorPendingAnimations); 5662 visitor->trace(m_compositorPendingAnimations);
5666 visitor->trace(m_contextDocument); 5663 visitor->trace(m_contextDocument);
5667 visitor->template registerWeakMembers<Document, &Document::clearWeakMembers> (this);
5668 WillBeHeapSupplementable<Document>::trace(visitor); 5664 WillBeHeapSupplementable<Document>::trace(visitor);
5669 #endif 5665 #endif
5670 TreeScope::trace(visitor); 5666 TreeScope::trace(visitor);
5671 ContainerNode::trace(visitor); 5667 ContainerNode::trace(visitor);
5672 ExecutionContext::trace(visitor); 5668 ExecutionContext::trace(visitor);
5673 DocumentLifecycleNotifier::trace(visitor); 5669 DocumentLifecycleNotifier::trace(visitor);
5674 } 5670 }
5675 5671
5676 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>; 5672 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>;
5677 5673
5678 } // namespace blink 5674 } // namespace blink
5679 5675
5680 #ifndef NDEBUG 5676 #ifndef NDEBUG
5681 using namespace blink; 5677 using namespace blink;
5682 void showLiveDocumentInstances() 5678 void showLiveDocumentInstances()
5683 { 5679 {
5684 WeakDocumentSet& set = liveDocumentSet(); 5680 WeakDocumentSet& set = liveDocumentSet();
5685 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5681 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5686 for (Document* document : set) 5682 for (Document* document : set)
5687 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5683 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5688 } 5684 }
5689 #endif 5685 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698