Revert "revert surfaceflinger leak fix as it uncovered a crasher on xoom"
This reverts commit af6edba59e250adbdfa5b3c3be134f70d8c38a16.
Change-Id: I7793d3ca8a4d20a2b188364f47854328ab5f586d
diff --git a/include/utils/RefBase.h b/include/utils/RefBase.h
index a21a18b..ca17082 100644
--- a/include/utils/RefBase.h
+++ b/include/utils/RefBase.h
@@ -116,6 +116,20 @@
typedef RefBase basetype;
+ // used to override the RefBase destruction.
+ class Destroyer {
+ friend class RefBase;
+ friend class weakref_type;
+ 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();