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

Unified Diff: Source/core/dom/AXObjectCache.cpp

Issue 1072273006: Oilpan: Prepare moving AXObject to heap (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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 340616585a1efceb73bd691051ee2524ed4b56dc..7ac9b122083262bdb647f227d583a12fcc8b1974 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;
}
-AXObjectCache* AXObjectCache::create(Document& document)
+PassOwnPtrWillBeRawPtr<AXObjectCache> AXObjectCache::create(Document& document)
{
ASSERT(m_createFunction);
return (m_createFunction)(document);
@@ -55,22 +55,35 @@ AXObjectCache::~AXObjectCache()
}
ScopedAXObjectCache::ScopedAXObjectCache(Document& document)
- : m_document(document)
- , m_cache(0)
+#if ENABLE(OILPAN)
+ : m_isOwned(false)
+#else
+ : m_ownedCache(nullptr)
+#endif
+ , m_cache(nullptr)
{
if (AXObjectCache* existingCache = document.axObjectCache()) {
m_cache = existingCache;
- m_isScoped = false;
} else {
- m_isScoped = true;
- m_cache = AXObjectCache::create(m_document);
+#if ENABLE(OILPAN)
+ m_isOwned = true;
+ m_cache = AXObjectCache::create(document);
+#else
+ m_ownedCache = AXObjectCache::create(document);
+ m_cache = m_ownedCache.get();
+#endif
}
}
ScopedAXObjectCache::~ScopedAXObjectCache()
{
- if (m_isScoped)
- delete m_cache;
+#if ENABLE(OILPAN)
+ if (m_isOwned) {
+#else
+ if (m_ownedCache) {
+#endif
+ m_cache->dispose();
+ }
}
AXObjectCache* ScopedAXObjectCache::get()

Powered by Google App Engine
This is Rietveld 408576698