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

Unified Diff: Source/core/dom/AXObjectCache.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, 7 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/core/dom/AXObjectCache.cpp
diff --git a/Source/core/dom/AXObjectCache.cpp b/Source/core/dom/AXObjectCache.cpp
index 97d0fd002093a027e51be606d4468c34c09ffe09..f44cdb18d990016e7f21c0ece1c1f2f5b7c8646a 100644
--- a/Source/core/dom/AXObjectCache.cpp
+++ b/Source/core/dom/AXObjectCache.cpp
@@ -40,7 +40,7 @@ void AXObjectCache::init(AXObjectCacheCreateFunction function)
m_createFunction = function;
}
-PassOwnPtr<AXObjectCache> AXObjectCache::create(Document& document)
+PassOwnPtrWillBeRawPtr<AXObjectCache> AXObjectCache::create(Document& document)
{
ASSERT(m_createFunction);
return (m_createFunction)(document);
@@ -54,14 +54,17 @@ AXObjectCache::~AXObjectCache()
{
}
-PassOwnPtr<ScopedAXObjectCache> ScopedAXObjectCache::create(Document& document)
+PassOwnPtrWillBeRawPtr<ScopedAXObjectCache> ScopedAXObjectCache::create(Document& document)
{
- return adoptPtr(new ScopedAXObjectCache(document));
+ return adoptPtrWillBeNoop(new ScopedAXObjectCache(document));
}
ScopedAXObjectCache::ScopedAXObjectCache(Document& document)
: m_ownedCache(nullptr)
, m_cache(nullptr)
+#if ENABLE(ASSERT)
+ , m_hasBeenDisposed(false)
+#endif
{
if (AXObjectCache* existingCache = document.axObjectCache()) {
m_cache = existingCache;
@@ -71,10 +74,30 @@ ScopedAXObjectCache::ScopedAXObjectCache(Document& document)
}
}
+ScopedAXObjectCache::~ScopedAXObjectCache()
+{
+ ASSERT(m_hasBeenDisposed);
+}
+
+void ScopedAXObjectCache::dispose()
+{
+ if (m_ownedCache)
+ m_ownedCache->dispose();
+#if ENABLE(ASSERT)
+ m_hasBeenDisposed = true;
+#endif
+}
+
AXObjectCache* ScopedAXObjectCache::get()
{
ASSERT(m_cache);
return m_cache;
}
+DEFINE_TRACE(ScopedAXObjectCache)
+{
+ visitor->trace(m_ownedCache);
+ visitor->trace(m_cache);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698