Chromium Code Reviews| Index: Source/core/dom/AXObjectCache.cpp |
| diff --git a/Source/core/dom/AXObjectCache.cpp b/Source/core/dom/AXObjectCache.cpp |
| index 340616585a1efceb73bd691051ee2524ed4b56dc..97d0fd002093a027e51be606d4468c34c09ffe09 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) |
| +PassOwnPtr<AXObjectCache> AXObjectCache::create(Document& document) |
| { |
| ASSERT(m_createFunction); |
| return (m_createFunction)(document); |
| @@ -54,34 +54,27 @@ AXObjectCache::~AXObjectCache() |
| { |
| } |
| +PassOwnPtr<ScopedAXObjectCache> ScopedAXObjectCache::create(Document& document) |
| +{ |
| + return adoptPtr(new ScopedAXObjectCache(document)); |
| +} |
| + |
| ScopedAXObjectCache::ScopedAXObjectCache(Document& document) |
| - : m_document(document) |
| - , m_cache(0) |
| + : m_ownedCache(nullptr) |
|
haraken
2015/05/28 08:50:08
This wouldn't be necessary.
keishi
2015/05/29 05:05:05
Done.
|
| + , m_cache(nullptr) |
| { |
| if (AXObjectCache* existingCache = document.axObjectCache()) { |
| m_cache = existingCache; |
| - m_isScoped = false; |
| } else { |
| - m_isScoped = true; |
| - m_cache = AXObjectCache::create(m_document); |
| + m_ownedCache = AXObjectCache::create(document); |
| + m_cache = m_ownedCache.get(); |
| } |
| } |
| -ScopedAXObjectCache::~ScopedAXObjectCache() |
| -{ |
| - if (m_isScoped) |
| - delete m_cache; |
| -} |
| - |
| AXObjectCache* ScopedAXObjectCache::get() |
| { |
| ASSERT(m_cache); |
| return m_cache; |
| } |
| -AXObjectCache* ScopedAXObjectCache::operator->() |
| -{ |
| - return get(); |
| -} |
| - |
| } // namespace blink |