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

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 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2192 return top.frame()->pagePopupOwner()->document().axObjectCacheOwner(); 2192 return top.frame()->pagePopupOwner()->document().axObjectCacheOwner();
2193 } 2193 }
2194 return top; 2194 return top;
2195 } 2195 }
2196 2196
2197 void Document::clearAXObjectCache() 2197 void Document::clearAXObjectCache()
2198 { 2198 {
2199 ASSERT(&axObjectCacheOwner() == this); 2199 ASSERT(&axObjectCacheOwner() == this);
2200 // Clear the cache member variable before calling delete because attempts 2200 // Clear the cache member variable before calling delete because attempts
2201 // are made to access it during destruction. 2201 // are made to access it during destruction.
2202 if (m_axObjectCache)
2203 m_axObjectCache->dispose();
2202 m_axObjectCache.clear(); 2204 m_axObjectCache.clear();
2203 } 2205 }
2204 2206
2205 AXObjectCache* Document::existingAXObjectCache() const 2207 AXObjectCache* Document::existingAXObjectCache() const
2206 { 2208 {
2207 // If the layoutObject is gone then we are in the process of destruction. 2209 // If the layoutObject is gone then we are in the process of destruction.
2208 // This method will be called before m_frame = nullptr. 2210 // This method will be called before m_frame = nullptr.
2209 if (!axObjectCacheOwner().layoutView()) 2211 if (!axObjectCacheOwner().layoutView())
2210 return 0; 2212 return 0;
2211 2213
(...skipping 3325 matching lines...) Expand 10 before | Expand all | Expand 10 after
5537 } 5539 }
5538 5540
5539 void Document::platformColorsChanged() 5541 void Document::platformColorsChanged()
5540 { 5542 {
5541 if (!isActive()) 5543 if (!isActive())
5542 return; 5544 return;
5543 5545
5544 styleEngine().platformColorsChanged(); 5546 styleEngine().platformColorsChanged();
5545 } 5547 }
5546 5548
5547 void Document::clearWeakMembers(Visitor* visitor)
5548 {
5549 if (m_axObjectCache)
5550 m_axObjectCache->clearWeakMembers(visitor);
5551 }
5552
5553 v8::Local<v8::Object> Document::wrap(v8::Isolate* isolate, v8::Local<v8::Object> creationContext) 5549 v8::Local<v8::Object> Document::wrap(v8::Isolate* isolate, v8::Local<v8::Object> creationContext)
5554 { 5550 {
5555 // It's possible that no one except for the new wrapper owns this object at 5551 // It's possible that no one except for the new wrapper owns this object at
5556 // this moment, so we have to prevent GC to collect this object until the 5552 // this moment, so we have to prevent GC to collect this object until the
5557 // object gets associated with the wrapper. 5553 // object gets associated with the wrapper.
5558 RefPtrWillBeRawPtr<Document> protect(this); 5554 RefPtrWillBeRawPtr<Document> protect(this);
5559 5555
5560 ASSERT(!DOMDataStore::containsWrapper(this, isolate)); 5556 ASSERT(!DOMDataStore::containsWrapper(this, isolate));
5561 5557
5562 const WrapperTypeInfo* wrapperType = wrapperTypeInfo(); 5558 const WrapperTypeInfo* wrapperType = wrapperTypeInfo();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
5621 #if ENABLE(OILPAN) 5617 #if ENABLE(OILPAN)
5622 visitor->trace(m_importsController); 5618 visitor->trace(m_importsController);
5623 visitor->trace(m_docType); 5619 visitor->trace(m_docType);
5624 visitor->trace(m_implementation); 5620 visitor->trace(m_implementation);
5625 visitor->trace(m_autofocusElement); 5621 visitor->trace(m_autofocusElement);
5626 visitor->trace(m_focusedElement); 5622 visitor->trace(m_focusedElement);
5627 visitor->trace(m_hoverNode); 5623 visitor->trace(m_hoverNode);
5628 visitor->trace(m_activeHoverElement); 5624 visitor->trace(m_activeHoverElement);
5629 visitor->trace(m_documentElement); 5625 visitor->trace(m_documentElement);
5630 visitor->trace(m_titleElement); 5626 visitor->trace(m_titleElement);
5627 visitor->trace(m_axObjectCache);
5631 visitor->trace(m_markers); 5628 visitor->trace(m_markers);
5632 visitor->trace(m_cssTarget); 5629 visitor->trace(m_cssTarget);
5633 visitor->trace(m_currentScriptStack); 5630 visitor->trace(m_currentScriptStack);
5634 visitor->trace(m_scriptRunner); 5631 visitor->trace(m_scriptRunner);
5635 visitor->trace(m_listsInvalidatedAtDocument); 5632 visitor->trace(m_listsInvalidatedAtDocument);
5636 for (int i = 0; i < numNodeListInvalidationTypes; ++i) 5633 for (int i = 0; i < numNodeListInvalidationTypes; ++i)
5637 visitor->trace(m_nodeLists[i]); 5634 visitor->trace(m_nodeLists[i]);
5638 visitor->trace(m_cssCanvasElements); 5635 visitor->trace(m_cssCanvasElements);
5639 visitor->trace(m_topLayerElements); 5636 visitor->trace(m_topLayerElements);
5640 visitor->trace(m_elemSheet); 5637 visitor->trace(m_elemSheet);
(...skipping 19 matching lines...) Expand all
5660 visitor->trace(m_layerUpdateSVGFilterElements); 5657 visitor->trace(m_layerUpdateSVGFilterElements);
5661 visitor->trace(m_timers); 5658 visitor->trace(m_timers);
5662 visitor->trace(m_templateDocument); 5659 visitor->trace(m_templateDocument);
5663 visitor->trace(m_templateDocumentHost); 5660 visitor->trace(m_templateDocumentHost);
5664 visitor->trace(m_visibilityObservers); 5661 visitor->trace(m_visibilityObservers);
5665 visitor->trace(m_userActionElements); 5662 visitor->trace(m_userActionElements);
5666 visitor->trace(m_svgExtensions); 5663 visitor->trace(m_svgExtensions);
5667 visitor->trace(m_timeline); 5664 visitor->trace(m_timeline);
5668 visitor->trace(m_compositorPendingAnimations); 5665 visitor->trace(m_compositorPendingAnimations);
5669 visitor->trace(m_contextDocument); 5666 visitor->trace(m_contextDocument);
5670 visitor->template registerWeakMembers<Document, &Document::clearWeakMembers> (this);
5671 WillBeHeapSupplementable<Document>::trace(visitor); 5667 WillBeHeapSupplementable<Document>::trace(visitor);
5672 #endif 5668 #endif
5673 TreeScope::trace(visitor); 5669 TreeScope::trace(visitor);
5674 ContainerNode::trace(visitor); 5670 ContainerNode::trace(visitor);
5675 ExecutionContext::trace(visitor); 5671 ExecutionContext::trace(visitor);
5676 DocumentLifecycleNotifier::trace(visitor); 5672 DocumentLifecycleNotifier::trace(visitor);
5677 } 5673 }
5678 5674
5679 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>; 5675 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>;
5680 5676
5681 } // namespace blink 5677 } // namespace blink
5682 5678
5683 #ifndef NDEBUG 5679 #ifndef NDEBUG
5684 using namespace blink; 5680 using namespace blink;
5685 void showLiveDocumentInstances() 5681 void showLiveDocumentInstances()
5686 { 5682 {
5687 WeakDocumentSet& set = liveDocumentSet(); 5683 WeakDocumentSet& set = liveDocumentSet();
5688 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5684 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5689 for (Document* document : set) 5685 for (Document* document : set)
5690 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5686 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5691 } 5687 }
5692 #endif 5688 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698