Index: third_party/grpc/test/core/util/slice_splitter.h |
diff --git a/third_party/tcmalloc/vendor/src/base/spinlock_internal.h b/third_party/grpc/test/core/util/slice_splitter.h |
similarity index 53% |
copy from third_party/tcmalloc/vendor/src/base/spinlock_internal.h |
copy to third_party/grpc/test/core/util/slice_splitter.h |
index 44942609f40a87492a7aeed0068a5e27bf9cd157..d030c2cb5553cf672230c1493665a4fe9e84a7cc 100644 |
--- a/third_party/tcmalloc/vendor/src/base/spinlock_internal.h |
+++ b/third_party/grpc/test/core/util/slice_splitter.h |
@@ -1,4 +1,6 @@ |
-/* Copyright (c) 2010, Google Inc. |
+/* |
+ * |
+ * Copyright 2015, Google Inc. |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
@@ -27,38 +29,40 @@ |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* |
- * --- |
- * This file is an internal part spinlock.cc and once.cc |
- * It may not be used directly by code outside of //base. |
*/ |
-#ifndef BASE_SPINLOCK_INTERNAL_H_ |
-#define BASE_SPINLOCK_INTERNAL_H_ |
+#ifndef GRPC_TEST_CORE_UTIL_SLICE_SPLITTER_H |
+#define GRPC_TEST_CORE_UTIL_SLICE_SPLITTER_H |
+ |
+/* utility function to split/merge slices together to help create test |
+ cases */ |
+ |
+#include <grpc/support/slice.h> |
+#include <grpc/support/slice_buffer.h> |
+ |
+typedef enum { |
+ /* merge all input slices into a single slice */ |
+ GRPC_SLICE_SPLIT_MERGE_ALL, |
+ /* leave slices as is */ |
+ GRPC_SLICE_SPLIT_IDENTITY, |
+ /* split slices into one byte chunks */ |
+ GRPC_SLICE_SPLIT_ONE_BYTE |
+} grpc_slice_split_mode; |
-#include <config.h> |
-#include "base/basictypes.h" |
-#include "base/atomicops.h" |
+/* allocates *dst_slices; caller must unref all slices in dst_slices then free |
+ it */ |
+void grpc_split_slices(grpc_slice_split_mode mode, gpr_slice *src_slices, |
+ size_t src_slice_count, gpr_slice **dst_slices, |
+ size_t *dst_slice_count); |
-namespace base { |
-namespace internal { |
+void grpc_split_slices_to_buffer(grpc_slice_split_mode mode, |
+ gpr_slice *src_slices, size_t src_slice_count, |
+ gpr_slice_buffer *dst); |
+void grpc_split_slice_buffer(grpc_slice_split_mode mode, gpr_slice_buffer *src, |
+ gpr_slice_buffer *dst); |
-// SpinLockWait() waits until it can perform one of several transitions from |
-// "from" to "to". It returns when it performs a transition where done==true. |
-struct SpinLockWaitTransition { |
- int32 from; |
- int32 to; |
- bool done; |
-}; |
+gpr_slice grpc_slice_merge(gpr_slice *slices, size_t nslices); |
-// Wait until *w can transition from trans[i].from to trans[i].to for some i |
-// satisfying 0<=i<n && trans[i].done, atomically make the transition, |
-// then return the old value of *w. Make any other atomic tranistions |
-// where !trans[i].done, but continue waiting. |
-int32 SpinLockWait(volatile Atomic32 *w, int n, |
- const SpinLockWaitTransition trans[]); |
-void SpinLockWake(volatile Atomic32 *w, bool all); |
-void SpinLockDelay(volatile Atomic32 *w, int32 value, int loop); |
+const char *grpc_slice_split_mode_name(grpc_slice_split_mode mode); |
-} // namespace internal |
-} // namespace base |
-#endif |
+#endif /* GRPC_TEST_CORE_UTIL_SLICE_SPLITTER_H */ |