aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/support/ref_counted.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lib/support/ref_counted.h')
-rw-r--r--src/core/lib/support/ref_counted.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/lib/support/ref_counted.h b/src/core/lib/support/ref_counted.h
index 4c662f9119..48c11f7bbf 100644
--- a/src/core/lib/support/ref_counted.h
+++ b/src/core/lib/support/ref_counted.h
@@ -23,6 +23,7 @@
#include <grpc/support/sync.h>
#include "src/core/lib/debug/trace.h"
+#include "src/core/lib/support/abstract.h"
#include "src/core/lib/support/debug_location.h"
#include "src/core/lib/support/memory.h"
@@ -45,6 +46,8 @@ class RefCounted {
RefCounted(const RefCounted&) = delete;
RefCounted& operator=(const RefCounted&) = delete;
+ GRPC_ABSTRACT_BASE_CLASS
+
protected:
// Allow Delete() to access destructor.
template <typename T>
@@ -98,18 +101,26 @@ class RefCountedWithTracing {
RefCountedWithTracing(const RefCountedWithTracing&) = delete;
RefCountedWithTracing& operator=(const RefCountedWithTracing&) = delete;
+ GRPC_ABSTRACT_BASE_CLASS
+
protected:
// Allow Delete() to access destructor.
template <typename T>
friend void Delete(T*);
- RefCountedWithTracing() : RefCountedWithTracing(nullptr) {}
+ RefCountedWithTracing()
+ : RefCountedWithTracing(static_cast<TraceFlag*>(nullptr)) {}
explicit RefCountedWithTracing(TraceFlag* trace_flag)
: trace_flag_(trace_flag) {
gpr_ref_init(&refs_, 1);
}
+#ifdef NDEBUG
+ explicit RefCountedWithTracing(DebugOnlyTraceFlag* trace_flag)
+ : RefCountedWithTracing() {}
+#endif
+
virtual ~RefCountedWithTracing() {}
private: