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: ref_counted.h:47
void RefNonZero()
Definition: ref_counted.h:99
bool Unref()
Definition: ref_counted.h:155
#define GRPC_SLICE_START_PTR(slice)
Definition: slice.h:96
#define GRPC_SLICE_LENGTH(slice)
Definition: slice.h:99
GPRAPI int grpc_slice_eq(grpc_slice a, grpc_slice b)
Definition: slice.cc:495
#define GPR_DEBUG_ASSERT(x)
Definition: log.h:101
GPRAPI void gpr_free(void *ptr)
free
Definition: alloc.cc:50
uint32_t gpr_murmur_hash3(const void *key, size_t len, uint32_t seed)
Definition: murmur_hash.cc:34
Round Robin Policy.
Definition: backend_metric.cc:26
std::unique_ptr< T, DefaultDeleteChar > UniquePtr
Definition: memory.h:47
uint32_t g_hash_seed
Definition: slice_intern.cc:67
grpc_slice_refcount kNoopRefcount(grpc_slice_refcount::Type::NOP)
Definition: slice_internal.h:187
uint64_t hash
Definition: ring_hash.cc:212
grpc_slice slice
Definition: server.cc:461
void grpc_slice_unref_internal(const grpc_slice &slice)
Definition: slice_internal.h:272
grpc_slice grpc_slice_maybe_static_intern(grpc_slice slice, bool *returned_slice_is_different)
Definition: slice_intern.cc:130
const grpc_slice & grpc_slice_ref_internal(const grpc_slice &slice)
Definition: slice_internal.h:265
grpc_core::UnmanagedMemorySlice grpc_slice_sub_no_ref(const grpc_core::UnmanagedMemorySlice &source, size_t begin, size_t end)
Definition: slice.cc:371
void grpc_test_only_set_slice_hash_seed(uint32_t seed)
Definition: slice_intern.cc:304
void grpc_slice_buffer_reset_and_unref_internal(grpc_slice_buffer *sb)
Definition: slice_buffer.cc:188
void grpc_slice_buffer_destroy_internal(grpc_slice_buffer *sb)
Definition: slice_buffer.cc:84
grpc_slice * grpc_slice_buffer_peek_first(grpc_slice_buffer *sb)
Definition: slice_internal.h:285
grpc_slice grpc_slice_from_moved_string(grpc_core::UniquePtr< char > p)
Definition: slice.cc:250
const uint8_t * grpc_refcounted_slice_data(const grpc_slice &slice)
Definition: slice_internal.h:221
uint32_t grpc_slice_default_hash_internal(const grpc_slice &s)
Definition: slice_internal.h:328
bool operator==(const grpc_slice &s1, const grpc_slice &s2)
Definition: slice_internal.h:361
size_t grpc_refcounted_slice_length(const grpc_slice &slice)
Definition: slice_internal.h:216
void grpc_slice_buffer_partial_unref_internal(grpc_slice_buffer *sb, size_t idx)
grpc_slice grpc_slice_from_cpp_string(std::string str)
Definition: slice.cc:255
void grpc_slice_intern_shutdown(void)
Definition: slice_intern.cc:351
grpc_slice grpc_slice_from_moved_buffer(grpc_core::UniquePtr< char > p, size_t len)
Definition: slice.cc:233
void grpc_slice_buffer_sub_first(grpc_slice_buffer *sb, size_t begin, size_t end)
Definition: slice_buffer.cc:400
uint32_t grpc_static_metadata_hash_values[GRPC_STATIC_MDSTR_COUNT]
Definition: slice_intern.cc:62
size_t grpc_slice_memory_usage(grpc_slice s)
Definition: slice.cc:96
uint32_t grpc_slice_hash_internal(const grpc_slice &s)
Definition: slice_internal.h:333
bool grpc_slice_is_interned(const grpc_slice &slice)
Definition: slice_internal.h:299
void grpc_slice_intern_init(void)
Definition: slice_intern.cc:309
uint32_t grpc_slice_hash_refcounted(const grpc_slice &s)
Definition: slice_internal.h:323
uint32_t grpc_static_slice_hash(grpc_slice s)
Definition: slice_intern.cc:120
bool grpc_slice_static_interned_equal(const grpc_slice &a, const grpc_slice &b)
Definition: slice_internal.h:305
int grpc_static_slice_eq(grpc_slice a, grpc_slice b)
Definition: slice_intern.cc:124
void grpc_slice_buffer_remove_first(grpc_slice_buffer *sb)
Definition: slice_buffer.cc:390
Definition: slice_internal.h:189
grpc_slice_refcount sub
Definition: slice_internal.h:207
InternedSliceRefcount * bucket_next
Definition: slice_internal.h:211
static void Destroy(void *arg)
Definition: slice_internal.h:190
~InternedSliceRefcount()
Definition: slice_intern.cc:70
grpc_slice_refcount base
Definition: slice_internal.h:206
const uint32_t hash
Definition: slice_internal.h:210
const size_t length
Definition: slice_internal.h:208
RefCount refcnt
Definition: slice_internal.h:209
InternedSliceRefcount(size_t length, uint32_t hash, InternedSliceRefcount *bucket_next)
Definition: slice_internal.h:196
Definition: slice_internal.h:353
std::size_t operator()(const grpc_slice &slice) const
Definition: slice_internal.h:354
Definition: slice_internal.h:176
const uint32_t index
Definition: slice_internal.h:184
StaticSliceRefcount(uint32_t index)
Definition: slice_internal.h:179
static grpc_slice_refcount kStaticSubRefcount
Definition: slice_internal.h:177
grpc_slice_refcount base
Definition: slice_internal.h:183
Definition: slice_utils.h:124
size_t length
Definition: slice.h:64
uint8_t * bytes
Definition: slice.h:65
Represents an expandable array of slices, to be interpreted as a single item.
Definition: slice.h:78
grpc_slice * slices
slices in the array (Points to the first valid grpc_slice in the array)
Definition: slice.h:84
size_t count
the number of slices in the array
Definition: slice.h:86
Definition: slice_internal.h:100
Type GetType() const
Definition: slice_internal.h:148
grpc_slice_refcount(Type t)
Definition: slice_internal.h:112
void(* DestroyerFn)(void *)
Definition: slice_internal.h:108
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
int Eq(const grpc_slice &a, const grpc_slice &b)
Definition: slice_internal.h:226
grpc_slice_refcount * sub_refcount() const
Definition: slice_internal.h:164
grpc_slice_refcount(grpc_slice_refcount *sub, Type type)
Definition: slice_internal.h:145
void Unref()
Definition: slice_internal.h:157
uint32_t Hash(const grpc_slice &slice)
Definition: slice_internal.h:246
void Ref()
Definition: slice_internal.h:153
grpc_slice_refcount()=default
Type
Definition: slice_internal.h:102
grpc_slice_refcount(grpc_slice_refcount *sub)
Definition: slice_internal.h:114
A grpc_slice s, if initialized, represents the byte range s.bytes[0..s.length-1].
Definition: slice.h:60
struct grpc_slice_refcount * refcount
Definition: slice.h:61
union grpc_slice::grpc_slice_data data
struct grpc_slice::grpc_slice_data::grpc_slice_refcounted refcounted
DiscoveryMechanismType type
Definition: xds_cluster_resolver.cc:73