diff options
author | Mathias Agopian <mathias@google.com> | 2011-06-15 20:21:31 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-06-15 20:21:31 -0700 |
commit | 85c14352a4f8946a6908eac140936080536fa575 (patch) | |
tree | f97feb4c06ceed98684b0431931c2eb6403d3999 /libs/utils | |
parent | f28f1de391d53b590f5ed963dcb9ae634e3196db (diff) | |
parent | 7ecdeb6e548ff71d4f70b343e30136e89eaa3e33 (diff) | |
download | frameworks_base-85c14352a4f8946a6908eac140936080536fa575.zip frameworks_base-85c14352a4f8946a6908eac140936080536fa575.tar.gz frameworks_base-85c14352a4f8946a6908eac140936080536fa575.tar.bz2 |
am 7ecdeb6e: am d20d72d1: Merge "revert surfaceflinger leak fix as it uncovered a crasher on xoom" into honeycomb-mr2
* commit '7ecdeb6e548ff71d4f70b343e30136e89eaa3e33':
revert surfaceflinger leak fix as it uncovered a crasher on xoom
Diffstat (limited to 'libs/utils')
-rw-r--r-- | libs/utils/RefBase.cpp | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/libs/utils/RefBase.cpp b/libs/utils/RefBase.cpp index 8db2009..2034486 100644 --- a/libs/utils/RefBase.cpp +++ b/libs/utils/RefBase.cpp @@ -49,11 +49,6 @@ namespace android { // --------------------------------------------------------------------------- -RefBase::Destroyer::~Destroyer() { -} - -// --------------------------------------------------------------------------- - class RefBase::weakref_impl : public RefBase::weakref_type { public: @@ -61,7 +56,7 @@ public: volatile int32_t mWeak; RefBase* const mBase; volatile int32_t mFlags; - Destroyer* mDestroyer; + #if !DEBUG_REFS @@ -70,7 +65,6 @@ public: , mWeak(0) , mBase(base) , mFlags(0) - , mDestroyer(0) { } @@ -363,11 +357,7 @@ void RefBase::decStrong(const void* id) const if (c == 1) { const_cast<RefBase*>(this)->onLastStrongRef(id); if ((refs->mFlags&OBJECT_LIFETIME_WEAK) != OBJECT_LIFETIME_WEAK) { - if (refs->mDestroyer) { - refs->mDestroyer->destroy(this); - } else { - delete this; - } + delete this; } } refs->decWeak(id); @@ -400,9 +390,7 @@ int32_t RefBase::getStrongCount() const return mRefs->mStrong; } -void RefBase::setDestroyer(RefBase::Destroyer* destroyer) { - mRefs->mDestroyer = destroyer; -} + RefBase* RefBase::weakref_type::refBase() const { @@ -426,28 +414,16 @@ void RefBase::weakref_type::decWeak(const void* id) if (c != 1) return; if ((impl->mFlags&OBJECT_LIFETIME_WEAK) != OBJECT_LIFETIME_WEAK) { - if (impl->mStrong == INITIAL_STRONG_VALUE) { - if (impl->mBase) { - if (impl->mDestroyer) { - impl->mDestroyer->destroy(impl->mBase); - } else { - delete impl->mBase; - } - } - } else { + if (impl->mStrong == INITIAL_STRONG_VALUE) + delete impl->mBase; + else { // LOGV("Freeing refs %p of old RefBase %p\n", this, impl->mBase); delete impl; } } else { impl->mBase->onLastWeakRef(id); if ((impl->mFlags&OBJECT_LIFETIME_FOREVER) != OBJECT_LIFETIME_FOREVER) { - if (impl->mBase) { - if (impl->mDestroyer) { - impl->mDestroyer->destroy(impl->mBase); - } else { - delete impl->mBase; - } - } + delete impl->mBase; } } } @@ -569,10 +545,8 @@ RefBase::RefBase() RefBase::~RefBase() { - if ((mRefs->mFlags & OBJECT_LIFETIME_WEAK) == OBJECT_LIFETIME_WEAK) { - if (mRefs->mWeak == 0) { - delete mRefs; - } + if (mRefs->mWeak == 0) { + delete mRefs; } } |