Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1359)

Unified Diff: webrtc/base/refcount.h

Issue 1988183002: Reimplement PooledI420Buffer, without an extra indirection. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add destructor, calling Release(). Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/common_video/i420_buffer_pool.cc » ('j') | webrtc/common_video/i420_buffer_pool.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/refcount.h
diff --git a/webrtc/base/refcount.h b/webrtc/base/refcount.h
index 55ce23a348b68a84ce362d98f85c0f871725303a..550a7122ae2fe9c2f6c22d4ad506cd329c59596f 100644
--- a/webrtc/base/refcount.h
+++ b/webrtc/base/refcount.h
@@ -107,15 +107,20 @@ 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.
+ 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() {
« no previous file with comments | « no previous file | webrtc/common_video/i420_buffer_pool.cc » ('j') | webrtc/common_video/i420_buffer_pool.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698