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

Unified Diff: Source/core/dom/TreeShared.h

Issue 262093006: Oilpan: Make the Node hierarchy RefCountedGarbageCollected instead of TreeShared. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Another build fix. Created 6 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/TreeShared.h
diff --git a/Source/core/dom/TreeShared.h b/Source/core/dom/TreeShared.h
index 71a4a5e64580a13d88d6f766a2f0968482098434..65ef726512bdb0b5c1733245811b68d2d6096499 100644
--- a/Source/core/dom/TreeShared.h
+++ b/Source/core/dom/TreeShared.h
@@ -38,9 +38,6 @@ template<typename NodeType> class TreeShared : public NoBaseWillBeGarbageCollect
protected:
TreeShared()
: m_refCount(1)
-#if ENABLE(OILPAN)
- , m_keepAlive(adoptPtr(new Persistent<NodeType>(static_cast<NodeType*>(this))))
-#endif
#if SECURITY_ASSERT_ENABLED
, m_deletionHasBegun(false)
#if ASSERT_ENABLED
@@ -56,11 +53,7 @@ protected:
{
ASSERT(isMainThread());
ASSERT(!m_refCount);
-#if !ENABLE(OILPAN)
ASSERT_WITH_SECURITY_IMPLICATION(m_deletionHasBegun);
-#else
- ASSERT(!m_keepAlive);
-#endif
ASSERT(!m_adoptionIsRequired);
}
@@ -68,64 +61,33 @@ public:
void ref()
{
ASSERT(isMainThread());
-#if !ENABLE(OILPAN)
ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun);
ASSERT(!m_inRemovedLastRefFunction);
-#endif
ASSERT(!m_adoptionIsRequired);
++m_refCount;
-#if ENABLE(OILPAN)
- if (!m_keepAlive)
- m_keepAlive = adoptPtr(new Persistent<NodeType>(static_cast<NodeType*>(this)));
-#endif
}
void deref()
{
ASSERT(isMainThread());
ASSERT(m_refCount > 0);
-#if !ENABLE(OILPAN)
ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun);
ASSERT(!m_inRemovedLastRefFunction);
-#endif
ASSERT(!m_adoptionIsRequired);
NodeType* thisNode = static_cast<NodeType*>(this);
if (!--m_refCount && !thisNode->hasTreeSharedParent()) {
#if !ASSERT_DISABLED
m_inRemovedLastRefFunction = true;
#endif
-#if ENABLE(OILPAN)
- clearKeepAlive();
-#endif
thisNode->removedLastRef();
}
}
int refCount() const { return m_refCount; }
-#if ENABLE(OILPAN)
- void clearKeepAlive()
- {
- ASSERT(m_keepAlive);
- m_keepAlive = nullptr;
- }
-#endif
-
private:
int m_refCount;
-#if ENABLE(OILPAN)
- // With Oilpan, a non-zero reference count will keep the TreeShared object alive
- // with a self-persistent handle. Whenever the ref count goes above zero
- // we register the TreeShared as a root for garbage collection by allocating a
- // persistent handle to the object itself. When the ref count goes to zero
- // we deallocate the persistent handle again so the object can die if there
- // are no other things keeping it alive.
- //
- // FIXME: Oilpan: Remove m_keepAlive and ref counting and use tracing instead.
- OwnPtr<Persistent<NodeType> > m_keepAlive;
-#endif
-
#if SECURITY_ASSERT_ENABLED
public:
bool m_deletionHasBegun;

Powered by Google App Engine
This is Rietveld 408576698