At the base level, the only task is to add reference counting data. Don't use RefCountedThreadSafe since it requires the destructor to be a virtual method. Creating a vtable for every BindState template instantiation results in a lot of bloat. Its only task is to call the destructor which can be done with a function pointer.
| 57 | // of bloat. Its only task is to call the destructor which can be done with a |
| 58 | // function pointer. |
| 59 | class BindStateBase { |
| 60 | protected: |
| 61 | explicit BindStateBase(void (*destructor)(BindStateBase*)) |
| 62 | : ref_count_(0), destructor_(destructor) {} |
| 63 | ~BindStateBase() {} |
| 64 | |
| 65 | private: |
| 66 | friend class scoped_refptr<BindStateBase>; |
| 67 | friend class CallbackBase; |
| 68 | |
| 69 | void AddRef(); |
| 70 | void Release(); |
| 71 | |
| 72 | AtomicRefCount ref_count_; |
| 73 | |
| 74 | // Pointer to a function that will properly destroy |this|. |
| 75 | void (*destructor_)(BindStateBase*); |
| 76 | |
| 77 | DISALLOW_COPY_AND_ASSIGN(BindStateBase); |
| 78 | }; |
| 79 | |
| 80 | // Holds the Callback methods that don't require specialization to reduce |
| 81 | // template bloat. |
nothing calls this directly
no outgoing calls
no test coverage detected