diff --git a/src/core/lib/iomgr/buffer_list.h b/src/core/lib/iomgr/buffer_list.h index 1e851dc4c9dfb8ee77b6bf258d9319e08d1503fb..8818f3c3b642e4773c65d18068ba44358126770a 100644 --- a/src/core/lib/iomgr/buffer_list.h +++ b/src/core/lib/iomgr/buffer_list.h @@ -114,6 +114,10 @@ struct Timestamps { #ifdef GRPC_LINUX_ERRQUEUE class TracedBuffer { public: + /** Use AddNewEntry function instead of using this directly. */ + TracedBuffer(uint32_t seq_no, void* arg) + : seq_no_(seq_no), arg_(arg), next_(nullptr) {} + /** Add a new entry in the TracedBuffer list pointed to by head. Also saves * sendmsg_time with the current timestamp. */ static void AddNewEntry(grpc_core::TracedBuffer** head, uint32_t seq_no, @@ -132,9 +136,6 @@ class TracedBuffer { static void Shutdown(grpc_core::TracedBuffer** head, void* remaining, grpc_error* shutdown_err); - TracedBuffer(uint32_t seq_no, void* arg) - : seq_no_(seq_no), arg_(arg), next_(nullptr) {} - private: uint32_t seq_no_; /* The sequence number for the last byte in the buffer */ void* arg_; /* The arg to pass to timestamps_callback */ diff --git a/src/core/lib/iomgr/cfstream_handle.h b/src/core/lib/iomgr/cfstream_handle.h index 96765b89037da445626cd86f1e97274d641f3638..b0f0664a04f7c14080a1795c0bd36149584817c7 100644 --- a/src/core/lib/iomgr/cfstream_handle.h +++ b/src/core/lib/iomgr/cfstream_handle.h @@ -43,10 +43,12 @@ class CFStreamHandle : public GrpcLibraryInitHolder { public: static CFStreamHandle* CreateStreamHandle(CFReadStreamRef read_stream, CFWriteStreamRef write_stream); - ~CFStreamHandle() override; + /** Use CreateStreamHandle function instead of using this directly. */ + CFStreamHandle(CFReadStreamRef read_stream, CFWriteStreamRef write_stream); CFStreamHandle(const CFStreamHandle& ref) = delete; CFStreamHandle(CFStreamHandle&& ref) = delete; CFStreamHandle& operator=(const CFStreamHandle& rhs) = delete; + ~CFStreamHandle() override; void NotifyOnOpen(grpc_closure* closure); void NotifyOnRead(grpc_closure* closure); @@ -57,7 +59,6 @@ class CFStreamHandle : public GrpcLibraryInitHolder { void Unref(const char* file = "", int line = 0, const char* reason = nullptr); private: - CFStreamHandle(CFReadStreamRef read_stream, CFWriteStreamRef write_stream); static void ReadCallback(CFReadStreamRef stream, CFStreamEventType type, void* client_callback_info); static void WriteCallback(CFWriteStreamRef stream, CFStreamEventType type, diff --git a/src/core/lib/slice/slice.cc b/src/core/lib/slice/slice.cc index 5cafb4a6f3f7d63fcc7ca218ec33b27e570cb7b8..a3936a8d2e338058f264ac7069ee875f79e4a2ab 100644 --- a/src/core/lib/slice/slice.cc +++ b/src/core/lib/slice/slice.cc @@ -87,7 +87,6 @@ class NewSliceRefcount { grpc_slice_refcount* base_refcount() { return &base_; } private: - grpc_slice_refcount base_; RefCount refs_; void (*user_destroy_)(void*); diff --git a/src/core/lib/slice/slice_hash_table.h b/src/core/lib/slice/slice_hash_table.h index f94fd08cad0cfb14f90ba5425f4c00a390061380..29a5fc6dd249dc18d6de3e38e2fb40fdf6d11c03 100644 --- a/src/core/lib/slice/slice_hash_table.h +++ b/src/core/lib/slice/slice_hash_table.h @@ -65,6 +65,10 @@ class SliceHashTable : public RefCounted<SliceHashTable<T>> { Entry* entries, ValueCmp value_cmp); + // Use Create function instead of using this directly. + SliceHashTable(size_t num_entries, Entry* entries, ValueCmp value_cmp); + virtual ~SliceHashTable(); + /// Returns the value from the table associated with \a key. /// Returns null if \a key is not found. const T* Get(const grpc_slice& key) const; @@ -77,9 +81,6 @@ class SliceHashTable : public RefCounted<SliceHashTable<T>> { /// - else, if value_cmp(a_value, b_value) < 1 (resp. > 1). static int Cmp(const SliceHashTable& a, const SliceHashTable& b); - SliceHashTable(size_t num_entries, Entry* entries, ValueCmp value_cmp); - virtual ~SliceHashTable(); - private: void Add(const grpc_slice& key, T& value); diff --git a/src/core/lib/slice/slice_weak_hash_table.h b/src/core/lib/slice/slice_weak_hash_table.h index 0d6915660337243107dc40af0f09f7f58c674272..931e405c1e305ade6cba8188ad2f93a08e3d3959 100644 --- a/src/core/lib/slice/slice_weak_hash_table.h +++ b/src/core/lib/slice/slice_weak_hash_table.h @@ -39,14 +39,15 @@ namespace grpc_core { template <typename T, size_t Size> class SliceWeakHashTable : public RefCounted<SliceWeakHashTable<T, Size>> { public: - SliceWeakHashTable() = default; - ~SliceWeakHashTable() = default; - /// Creates a new table of at most \a size entries. static RefCountedPtr<SliceWeakHashTable> Create() { return MakeRefCounted<SliceWeakHashTable<T, Size>>(); } + /// Use Create function instead of using this directly. + SliceWeakHashTable() = default; + ~SliceWeakHashTable() = default; + /// Add a mapping from \a key to \a value, taking ownership of \a key. This /// operation will always succeed. It may discard older entries. void Add(const grpc_slice& key, T value) { diff --git a/src/core/tsi/ssl/session_cache/ssl_session_cache.h b/src/core/tsi/ssl/session_cache/ssl_session_cache.h index 0808539a07e43ccdf1440b633875aff94f932234..2eadab25edddb2e7c162bafd9cf14e1029dba150 100644 --- a/src/core/tsi/ssl/session_cache/ssl_session_cache.h +++ b/src/core/tsi/ssl/session_cache/ssl_session_cache.h @@ -53,6 +53,7 @@ class SslSessionLRUCache : public grpc_core::RefCounted<SslSessionLRUCache> { return grpc_core::MakeRefCounted<SslSessionLRUCache>(capacity); } + // Use Create function instead of using this directly. explicit SslSessionLRUCache(size_t capacity); ~SslSessionLRUCache();