Clarify documentation on scoped_refptr::release.
NOTRY=True
Bug: None
Change-Id: I063ea848eb79dfa3d14817c28c582cd5399e711b
Reviewed-on: https://webrtc-review.googlesource.com/63620
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22551}
diff --git a/rtc_base/scoped_ref_ptr.h b/rtc_base/scoped_ref_ptr.h
index 0f4698a..8fefc73 100644
--- a/rtc_base/scoped_ref_ptr.h
+++ b/rtc_base/scoped_ref_ptr.h
@@ -103,11 +103,11 @@
operator T*() const { return ptr_; }
T* operator->() const { return ptr_; }
- // Release a pointer.
- // The return value is the current pointer held by this object.
- // If this object holds a null pointer, the return value is null.
- // After this operation, this object will hold a null pointer,
- // and will not own the object any more.
+ // Returns the (possibly null) raw pointer, and makes the scoped_refptr hold a
+ // null pointer, all without touching the reference count of the underlying
+ // pointed-to object. The object is still reference counted, and the caller of
+ // release() is now the proud owner of one reference, so it is responsible for
+ // calling Release() once on the object when no longer using it.
T* release() {
T* retVal = ptr_;
ptr_ = nullptr;