Commit bc3f0c91 authored by haraken@chromium.org's avatar haraken@chromium.org

RefCounted::derefBase() should do the decrement from 1 to 0

Currently derefBase() does not do the decrement from 1 to 0 because an object that has 0 refcount is going to die immediately (there is no need to do the decrement).

However, in the oilpan world, it's possible that an object that has 0 refcount is resurrected, because the object can still be retained through oilpan handles. Thus we need to manage the refcount correctly even when the refcount is going to be 0.

I'm making this change separately from oilpan changes, since this change might regress performance of something. derefBase() is performance-sensitive.

BUG=340522

Review URL: https://codereview.chromium.org/214453005

git-svn-id: svn://svn.chromium.org/blink/trunk@170256 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 68e6f35b
......@@ -118,14 +118,14 @@ protected:
#endif
ASSERT(m_refCount > 0);
if (m_refCount == 1) {
--m_refCount;
if (!m_refCount) {
#if SECURITY_ASSERT_ENABLED
m_deletionHasBegun = true;
#endif
return true;
}
--m_refCount;
#if CHECK_REF_COUNTED_LIFECYCLE
// Stop thread verification when the ref goes to 1 because it
// is safe to be passed to another thread at this point.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment