Go to the documentation of this file.
19 #ifndef GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H
20 #define GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H
142 dest_fn_(destroyer_fn),
143 destroy_fn_arg_(destroyer_arg) {}
146 : ref_type_(type), sub_refcount_(sub) {}
154 if (ref_ ==
nullptr)
return;
158 if (ref_ ==
nullptr)
return;
160 dest_fn_(destroy_fn_arg_);
171 void* destroy_fn_arg_ =
nullptr;
319 bool* returned_slice_is_different);
Definition: slice_internal.h:176
void grpc_slice_unref_internal(const grpc_slice &slice)
Definition: slice_internal.h:272
grpc_slice_refcount(grpc_slice_refcount *sub)
Definition: slice_internal.h:114
void(* DestroyerFn)(void *)
Definition: slice_internal.h:108
struct grpc_slice_refcount * refcount
Definition: slice.h:61
StaticSliceRefcount(uint32_t index)
Definition: slice_internal.h:179
grpc_slice_refcount base
Definition: slice_internal.h:206
Definition: slice_internal.h:189
bool Unref()
Definition: ref_counted.h:174
size_t length
Definition: slice.h:64
Round Robin Policy.
Definition: backend_metric.cc:24
InternedSliceRefcount(size_t length, uint32_t hash, InternedSliceRefcount *bucket_next)
Definition: slice_internal.h:196
int Eq(const grpc_slice &a, const grpc_slice &b)
Definition: slice_internal.h:226
RefCount refcnt
Definition: slice_internal.h:209
grpc_slice * slices
slices in the array (Points to the first valid grpc_slice in the array)
Definition: slice.h:84
GPRAPI void gpr_free(void *ptr)
free
Definition: alloc.cc:50
void grpc_slice_buffer_destroy_internal(grpc_slice_buffer *sb)
Definition: slice_buffer.cc:84
size_t grpc_refcounted_slice_length(const grpc_slice &slice)
Definition: slice_internal.h:216
grpc_slice_refcount(grpc_slice_refcount::Type type, grpc_core::RefCount *ref, DestroyerFn destroyer_fn, void *destroyer_arg, grpc_slice_refcount *sub)
Definition: slice_internal.h:136
static grpc_slice_refcount kStaticSubRefcount
Definition: slice_internal.h:177
Definition: slice_utils.h:122
uint32_t grpc_static_slice_hash(grpc_slice s)
Definition: slice_intern.cc:121
void Ref()
Definition: slice_internal.h:153
grpc_slice_refcount(grpc_slice_refcount *sub, Type type)
Definition: slice_internal.h:145
void grpc_slice_intern_init(void)
Definition: slice_intern.cc:312
void RefNonZero()
Definition: ref_counted.h:117
int grpc_static_slice_eq(grpc_slice a, grpc_slice b)
Definition: slice_intern.cc:125
const uint8_t * grpc_refcounted_slice_data(const grpc_slice &slice)
Definition: slice_internal.h:221
size_t count
the number of slices in the array
Definition: slice.h:86
grpc_slice grpc_slice_from_moved_string(grpc_core::UniquePtr< char > p)
Definition: slice.cc:230
grpc_slice_refcount(Type t)
Definition: slice_internal.h:112
Definition: slice_internal.h:100
grpc_slice grpc_slice_from_moved_buffer(grpc_core::UniquePtr< char > p, size_t len)
Definition: slice.cc:213
grpc_slice_refcount sub
Definition: slice_internal.h:207
uint32_t grpc_slice_default_hash_internal(const grpc_slice &s)
Definition: slice_internal.h:328
void grpc_slice_intern_shutdown(void)
Definition: slice_intern.cc:354
A grpc_slice s, if initialized, represents the byte range s.bytes[0..s.length-1].
Definition: slice.h:60
void grpc_slice_buffer_reset_and_unref_internal(grpc_slice_buffer *sb)
Definition: slice_buffer.cc:187
Type
Definition: slice_internal.h:102
uint32_t grpc_slice_hash_refcounted(const grpc_slice &s)
Definition: slice_internal.h:323
bool grpc_slice_static_interned_equal(const grpc_slice &a, const grpc_slice &b)
Definition: slice_internal.h:305
#define GPR_DEBUG_ASSERT(x)
Definition: log.h:103
grpc_slice_refcount base
Definition: slice_internal.h:183
const uint32_t hash
Definition: slice_internal.h:210
grpc_slice * grpc_slice_buffer_peek_first(grpc_slice_buffer *sb)
Definition: slice_internal.h:285
std::unique_ptr< T, DefaultDeleteChar > UniquePtr
Definition: memory.h:45
void grpc_slice_buffer_partial_unref_internal(grpc_slice_buffer *sb, size_t idx)
grpc_core::UnmanagedMemorySlice grpc_slice_sub_no_ref(const grpc_core::UnmanagedMemorySlice &source, size_t begin, size_t end)
Definition: slice.cc:334
struct grpc_slice::grpc_slice_data::grpc_slice_refcounted refcounted
Definition: ref_counted.h:62
#define GRPC_SLICE_START_PTR(slice)
Definition: slice.h:96
void Unref()
Definition: slice_internal.h:157
uint32_t Hash(const grpc_slice &slice)
Definition: slice_internal.h:246
void grpc_slice_buffer_sub_first(grpc_slice_buffer *sb, size_t begin, size_t end)
Definition: slice_buffer.cc:399
grpc_slice_refcount()=default
void grpc_slice_buffer_remove_first(grpc_slice_buffer *sb)
Definition: slice_buffer.cc:389
const grpc_slice & grpc_slice_ref_internal(const grpc_slice &slice)
Definition: slice_internal.h:265
~InternedSliceRefcount()
Definition: slice_intern.cc:71
const uint32_t index
Definition: slice_internal.h:184
Type GetType() const
Definition: slice_internal.h:148
union grpc_slice::grpc_slice_data data
uint32_t grpc_slice_hash_internal(const grpc_slice &s)
Definition: slice_internal.h:333
#define GRPC_SLICE_LENGTH(slice)
Definition: slice.h:99
uint8_t * bytes
Definition: slice.h:65
size_t grpc_slice_memory_usage(grpc_slice s)
Definition: slice.cc:96
InternedSliceRefcount * bucket_next
Definition: slice_internal.h:211
grpc_slice_refcount * sub_refcount() const
Definition: slice_internal.h:164
Represents an expandable array of slices, to be interpreted as a single item.
Definition: slice.h:78
grpc_slice grpc_slice_maybe_static_intern(grpc_slice slice, bool *returned_slice_is_different)
Definition: slice_intern.cc:131
void grpc_test_only_set_slice_hash_seed(uint32_t key)
Definition: slice_intern.cc:307
const size_t length
Definition: slice_internal.h:208
uint32_t gpr_murmur_hash3(const void *key, size_t len, uint32_t seed)
Definition: murmur_hash.cc:34
grpc_slice_refcount kNoopRefcount(grpc_slice_refcount::Type::NOP)
Definition: slice_internal.h:187
static void Destroy(void *arg)
Definition: slice_internal.h:190
uint32_t grpc_static_metadata_hash_values[GRPC_STATIC_MDSTR_COUNT]
Definition: slice_intern.cc:63
uint32_t g_hash_seed
Definition: slice_intern.cc:68
bool grpc_slice_is_interned(const grpc_slice &slice)
Definition: slice_internal.h:299