summaryrefslogtreecommitdiff
path: root/include/utils/RefBase.h
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2011-06-12 18:05:53 -0700
committer Mathias Agopian <mathias@google.com> 2011-06-13 18:39:45 -0700
commitddc31c3e2bc6ffe66695c385d23e8ccc3c6dad06 (patch)
treedc823058282daaf8d85a5a2c69feb3dd0f20bd93 /include/utils/RefBase.h
parent5eabb2c13cf2fb41861dd29c76e3ead91c2bec0e (diff)
fix RefBase so it retains binary-compatibility with gingerbread
Bug: 4595257 Change-Id: I0d5e10f497e3f39868bff58f6ded510c38b44b12
Diffstat (limited to 'include/utils/RefBase.h')
-rw-r--r--include/utils/RefBase.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/include/utils/RefBase.h b/include/utils/RefBase.h
index 412622596c..f8c3216b46 100644
--- a/include/utils/RefBase.h
+++ b/include/utils/RefBase.h
@@ -116,16 +116,22 @@ public:
typedef RefBase basetype;
-protected:
- RefBase();
- virtual ~RefBase();
+ // used to override the RefBase destruction.
+ class Destroyer {
+ friend class RefBase;
+ public:
+ virtual ~Destroyer();
+ private:
+ virtual void destroy(RefBase const* base) = 0;
+ };
- // 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;
+ void setDestroyer(Destroyer* destroyer);
+
+protected:
+ RefBase();
+ virtual ~RefBase();
//! Flags for extendObjectLifetime()
enum {