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

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

Powered by Google App Engine
This is Rietveld 408576698