fix RefBase so it retains binary-compatibility with gingerbread (DO NOT MERGE)
Bug: 4595257
Change-Id: I4773cf4fe59b2509db0ed733739eb6961d473b25
diff --git a/include/utils/RefBase.h b/include/utils/RefBase.h
index 1b4a310..d92cfb0 100644
--- a/include/utils/RefBase.h
+++ b/include/utils/RefBase.h
@@ -112,17 +112,23 @@
getWeakRefs()->trackMe(enable, retain);
}
+ // used to override the RefBase destruction.
+ class Destroyer {
+ friend class RefBase;
+ public:
+ virtual ~Destroyer();
+ private:
+ virtual void destroy(RefBase const* base) = 0;
+ };
+
+ // Make sure to never acquire a strong reference from this function. The
+ // same restrictions than for destructors apply.
+ void setDestroyer(Destroyer* destroyer);
+
protected:
RefBase();
virtual ~RefBase();
- // called when the last reference goes away. this is responsible for
- // calling the destructor. The default implementation just does
- // "delete this;".
- // Make sure to never acquire a strong reference from this function. The
- // same restrictions than for destructors apply.
- virtual void destroy() const;
-
//! Flags for extendObjectLifetime()
enum {
OBJECT_LIFETIME_WEAK = 0x0001,