diff options
author | Craig Tiller <ctiller@google.com> | 2017-01-23 14:54:31 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-01-23 14:54:31 -0800 |
commit | a53c193aa5dd9916c0d60693ab1e77b3501265ed (patch) | |
tree | 68be63155952d1844b621454b1b4b6435a6a5cdd /include/grpc/impl/codegen/slice.h | |
parent | 7fa7d6817ef99cdf75690b55962c44b40f09a700 (diff) | |
parent | 889b0a45352928e2a815c34d5f849be9641284b0 (diff) |
Merge github.com:grpc/grpc into faster_slices
Diffstat (limited to 'include/grpc/impl/codegen/slice.h')
-rw-r--r-- | include/grpc/impl/codegen/slice.h | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/include/grpc/impl/codegen/slice.h b/include/grpc/impl/codegen/slice.h index 0b09a0bfd8..035260445e 100644 --- a/include/grpc/impl/codegen/slice.h +++ b/include/grpc/impl/codegen/slice.h @@ -40,8 +40,6 @@ #include <grpc/impl/codegen/exec_ctx_fwd.h> #include <grpc/impl/codegen/gpr_slice.h> -typedef struct grpc_slice grpc_slice; - /* Slice API A slice represents a contiguous reference counted array of bytes. @@ -55,25 +53,14 @@ typedef struct grpc_slice grpc_slice; reference ownership semantics (who should call unref?) and mutability constraints (is the callee allowed to modify the slice?) */ -typedef struct grpc_slice_refcount_vtable { - void (*ref)(void *); - void (*unref)(grpc_exec_ctx *exec_ctx, void *); - int (*eq)(grpc_slice a, grpc_slice b); - uint32_t (*hash)(grpc_slice slice); -} grpc_slice_refcount_vtable; - /* Reference count container for grpc_slice. Contains function pointers to increment and decrement reference counts. Implementations should cleanup when the reference count drops to zero. Typically client code should not touch this, and use grpc_slice_malloc, grpc_slice_new, or grpc_slice_new_with_len instead. */ typedef struct grpc_slice_refcount { - const grpc_slice_refcount_vtable *vtable; - /* If a subset of this slice is taken, use this pointer for the refcount. - Typically points back to the refcount itself, however iterning - implementations can use this to avoid a verification step on each hash - or equality check */ - struct grpc_slice_refcount *sub_refcount; + void (*ref)(void *); + void (*unref)(grpc_exec_ctx *exec_ctx, void *); } grpc_slice_refcount; #define GRPC_SLICE_INLINED_SIZE (sizeof(size_t) + sizeof(uint8_t *) - 1) @@ -87,7 +74,7 @@ typedef struct grpc_slice_refcount { If the slice does not have a refcount, it represents an inlined small piece of data that is copied by value. */ -struct grpc_slice { +typedef struct grpc_slice { struct grpc_slice_refcount *refcount; union { struct { @@ -99,7 +86,7 @@ struct grpc_slice { uint8_t bytes[GRPC_SLICE_INLINED_SIZE]; } inlined; } data; -}; +} grpc_slice; #define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 8 |