18 #ifndef ION_BASE_SHAREABLE_H_
19 #define ION_BASE_SHAREABLE_H_
21 #include "base/macros.h"
46 void IncrementRefCount()
const { ++ref_count_; }
47 void DecrementRefCount()
const {
48 const int new_count = --ref_count_;
55 virtual void OnZeroRefCount()
const {
delete this; }
59 mutable std::atomic<int> ref_count_;
71 #endif // ION_BASE_SHAREABLE_H_
virtual ~Shareable()
The destructor is protected because all instances should be managed through SharedPtr.
Shareable is an abstract base class for any object that can be shared via the SharedPtr class...
int GetRefCount() const
GetRefCount() is part of the interface necessary for SharedPtr.
#define DCHECK_GE(val1, val2)
Copyright 2016 Google Inc.
Abstract base class that inherits from Referent, and adds the ability for instances to be referenced ...
#define DCHECK_EQ(val1, val2)
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting...