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

Unified Diff: Source/modules/accessibility/AXObjectCacheImpl.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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/accessibility/AXObjectCacheImpl.cpp
diff --git a/Source/modules/accessibility/AXObjectCacheImpl.cpp b/Source/modules/accessibility/AXObjectCacheImpl.cpp
index 3a0f1f8bdd7785ce33fc395bf040adbbedc088e8..a9ce94309716e1ca7885c5466cef259a06ab5d20 100644
--- a/Source/modules/accessibility/AXObjectCacheImpl.cpp
+++ b/Source/modules/accessibility/AXObjectCacheImpl.cpp
@@ -84,20 +84,28 @@ namespace blink {
using namespace HTMLNames;
// static
-AXObjectCache* AXObjectCacheImpl::create(Document& document)
+PassOwnPtrWillBeRawPtr<AXObjectCache> AXObjectCacheImpl::create(Document& document)
{
- return new AXObjectCacheImpl(document);
+ return adoptPtrWillBeNoop(new AXObjectCacheImpl(document));
}
AXObjectCacheImpl::AXObjectCacheImpl(Document& document)
: m_document(document)
, m_modificationCount(0)
+#if ENABLE(ASSERT)
+ , m_hasBeenDisposed(false)
+#endif
, m_notificationPostTimer(this, &AXObjectCacheImpl::notificationPostTimerFired)
{
}
AXObjectCacheImpl::~AXObjectCacheImpl()
{
+ ASSERT(m_hasBeenDisposed);
+}
+
+void AXObjectCacheImpl::dispose()
+{
m_notificationPostTimer.stop();
HashMap<AXID, RefPtr<AXObject>>::iterator end = m_objects.end();
@@ -106,6 +114,10 @@ AXObjectCacheImpl::~AXObjectCacheImpl()
obj->detach();
removeAXID(obj);
}
+
+#if ENABLE(ASSERT)
+ m_hasBeenDisposed = true;
+#endif
}
AXObject* AXObjectCacheImpl::root()
@@ -1353,4 +1365,10 @@ void AXObjectCacheImpl::setCanvasObjectBounds(Element* element, const LayoutRect
obj->setElementRect(rect);
}
+DEFINE_TRACE(AXObjectCacheImpl)
+{
+ visitor->template registerWeakMembers<AXObjectCacheImpl, &AXObjectCacheImpl::clearWeakMembers>(this);
+ AXObjectCache::trace(visitor);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698