Index: third_party/grpc/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.m |
diff --git a/third_party/tcmalloc/chromium/src/base/synchronization_profiling.h b/third_party/grpc/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.m |
similarity index 67% |
copy from third_party/tcmalloc/chromium/src/base/synchronization_profiling.h |
copy to third_party/grpc/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.m |
index cf02c218a111806189f71f7b528a83b5ceb164a4..5fc81e329289a53c6acad26f627cc68396f93938 100644 |
--- a/third_party/tcmalloc/chromium/src/base/synchronization_profiling.h |
+++ b/third_party/grpc/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.m |
@@ -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,24 +29,26 @@ |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* |
- * --- |
- * Author: Chris Ruemmler |
*/ |
-#ifndef BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ |
-#define BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ |
+#import "NSEnumerator+GRXUtil.h" |
+ |
+#import "private/GRXNSBlockEnumerator.h" |
+#import "private/GRXNSFastEnumerator.h" |
+#import "private/GRXNSScalarEnumerator.h" |
-#include "base/basictypes.h" |
+@implementation NSEnumerator (GRXUtil) |
-namespace base { |
++ (NSEnumerator *)grx_enumeratorWithContainer:(id<NSFastEnumeration>)container { |
+ // TODO(jcanizales): Consider checking if container responds to objectEnumerator and return that? |
+ return [[GRXNSFastEnumerator alloc] initWithContainer:container]; |
+} |
-// We can do contention-profiling of SpinLocks, but the code is in |
-// mutex.cc, which is not always linked in with spinlock. Hence we |
-// provide a weak definition, which are used if mutex.cc isn't linked in. |
++ (NSEnumerator *)grx_enumeratorWithSingleValue:(id)value { |
+ return [[GRXNSScalarEnumerator alloc] initWithValue:value]; |
+} |
-// Submit the number of cycles the spinlock spent contending. |
-ATTRIBUTE_WEAK extern void SubmitSpinLockProfileData(const void *, int64); |
-extern void SubmitSpinLockProfileData(const void *contendedlock, |
- int64 wait_cycles) {} |
++ (NSEnumerator *)grx_enumeratorWithValueSupplier:(id (^)())block { |
+ return [[GRXNSBlockEnumerator alloc] initWithValueSupplier:block]; |
} |
-#endif // BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ |
+@end |