summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Bowden <sbowden@google.com>2022-06-06 11:34:52 +0000
committerSimon Bowden <sbowden@google.com>2022-06-06 11:34:55 +0000
commit10317edca59379067a6c2a3d8302f26eb9570ba6 (patch)
tree7d54df45d204d07bec1df6481f158407b98438ef
parenta70c45dbfec0c6a05470459b5aba5e5ac6d348d3 (diff)
downloadnative-10317edca59379067a6c2a3d8302f26eb9570ba6.tar.gz
Add a comment on how to achieve shared_from_this for SharedRefBase.
It was time-consuming to figure out what was happening here as a newcomer. Linking to the bug where conversion was attempted for blame log convenience. I also tweaked the main description to be a bit clearer. Bug: 194905505 Change-Id: Ie5fc5a508c65c8a105a720cbef07ffdfdc6e7395 Test: comments-only
-rw-r--r--libs/binder/ndk/include_cpp/android/binder_interface_utils.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/binder/ndk/include_cpp/android/binder_interface_utils.h b/libs/binder/ndk/include_cpp/android/binder_interface_utils.h
index b3bc7f449e..766df16635 100644
--- a/libs/binder/ndk/include_cpp/android/binder_interface_utils.h
+++ b/libs/binder/ndk/include_cpp/android/binder_interface_utils.h
@@ -43,10 +43,12 @@
namespace ndk {
/**
- * analog using std::shared_ptr for internally held refcount
+ * Binder analog to using std::shared_ptr for an internally held refcount.
*
* ref must be called at least one time during the lifetime of this object. The recommended way to
* construct this object is with SharedRefBase::make.
+ *
+ * If you need a "this" shared reference analogous to shared_from_this, use this->ref().
*/
class SharedRefBase {
public: