Index: webrtc/base/refcount.h |
diff --git a/webrtc/base/refcount.h b/webrtc/base/refcount.h |
index 55ce23a348b68a84ce362d98f85c0f871725303a..4f4ab0fbf826f20926e0267ac46c617311e96c79 100644 |
--- a/webrtc/base/refcount.h |
+++ b/webrtc/base/refcount.h |
@@ -107,15 +107,24 @@ class RefCountedObject : public T { |
return count; |
} |
+ // This call returns the reference count, and performs the memory |
+ // barrier needed for the owning thread to act on the object, in |
+ // case the value of the reference count implies exclusive access to |
+ // the object. |
+ // TODO(nisse): Currently used only by |
+ // I420BufferPool::PooledI420Buffer. Consider deleting once |
+ // IsMutable is deleted, see |
+ // https://bugs.chromium.org/p/webrtc/issues/detail?id=5921 |
+ virtual int GetRefCount() const { |
+ return AtomicOps::AcquireLoad(&ref_count_); |
+ } |
// Return whether the reference count is one. If the reference count is used |
// in the conventional way, a reference count of 1 implies that the current |
// thread owns the reference and no other thread shares it. This call |
// performs the test for a reference count of one, and performs the memory |
// barrier needed for the owning thread to act on the object, knowing that it |
// has exclusive access to the object. |
- virtual bool HasOneRef() const { |
- return AtomicOps::AcquireLoad(&ref_count_) == 1; |
- } |
+ virtual bool HasOneRef() const { return GetRefCount() == 1; } |
protected: |
virtual ~RefCountedObject() { |