From 35f003b24eb26c1e51faf2ba8df4ab5784d17133 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Fri, 17 Jul 2015 21:14:36 -0700 Subject: [PATCH] Rename GRPCDelegateWrapper -> GRXConcurrentWriteable And move it to the RxLibrary. --- src/objective-c/GRPCClient/GRPCCall.m | 8 ++++---- .../GRXConcurrentWriteable.h} | 2 +- .../GRXConcurrentWriteable.m} | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) rename src/objective-c/{GRPCClient/private/GRPCDelegateWrapper.h => RxLibrary/GRXConcurrentWriteable.h} (98%) rename src/objective-c/{GRPCClient/private/GRPCDelegateWrapper.m => RxLibrary/GRXConcurrentWriteable.m} (97%) diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index 53e5abe177b..c41ea412135 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -35,10 +35,10 @@ #include #include +#import #import "private/GRPCChannel.h" #import "private/GRPCCompletionQueue.h" -#import "private/GRPCDelegateWrapper.h" #import "private/GRPCWrappedCall.h" #import "private/NSData+GRPC.h" #import "private/NSDictionary+GRPC.h" @@ -78,7 +78,7 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey"; // do. Particularly, in the face of errors, there's no ordering guarantee at // all. This wrapper over our actual writeable ensures thread-safety and // correct ordering. - GRPCDelegateWrapper *_responseWriteable; + GRXConcurrentWriteable *_responseWriteable; GRXWriter *_requestWriter; NSMutableDictionary *_requestMetadata; @@ -191,7 +191,7 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey"; return; } __weak GRPCCall *weakSelf = self; - __weak GRPCDelegateWrapper *weakWriteable = _responseWriteable; + __weak GRXConcurrentWriteable *weakWriteable = _responseWriteable; dispatch_async(_callQueue, ^{ [weakSelf startReadWithHandler:^(grpc_byte_buffer *message) { @@ -340,7 +340,7 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey"; // Care is taken not to retain self strongly in any of the blocks used in // the implementation of GRPCCall, so that the life of the instance is // determined by this retain cycle. - _responseWriteable = [[GRPCDelegateWrapper alloc] initWithWriteable:writeable writer:self]; + _responseWriteable = [[GRXConcurrentWriteable alloc] initWithWriteable:writeable writer:self]; [self sendHeaders:_requestMetadata]; [self invokeCall]; } diff --git a/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.h b/src/objective-c/RxLibrary/GRXConcurrentWriteable.h similarity index 98% rename from src/objective-c/GRPCClient/private/GRPCDelegateWrapper.h rename to src/objective-c/RxLibrary/GRXConcurrentWriteable.h index 9a30a2f9660..5d1e1dafc05 100644 --- a/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.h +++ b/src/objective-c/RxLibrary/GRXConcurrentWriteable.h @@ -48,7 +48,7 @@ // TODO(jcanizales): Let the user specify another queue for the writeable // callbacks. // TODO(jcanizales): Rename to GRXWriteableWrapper and move to the Rx library. -@interface GRPCDelegateWrapper : NSObject +@interface GRXConcurrentWriteable : NSObject // The GRXWriteable passed is the wrapped writeable. // Both the GRXWriter instance and the GRXWriteable instance are retained until diff --git a/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m b/src/objective-c/RxLibrary/GRXConcurrentWriteable.m similarity index 97% rename from src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m rename to src/objective-c/RxLibrary/GRXConcurrentWriteable.m index 294cfb7e239..b71098d73ba 100644 --- a/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m +++ b/src/objective-c/RxLibrary/GRXConcurrentWriteable.m @@ -31,17 +31,17 @@ * */ -#import "GRPCDelegateWrapper.h" +#import "GRXConcurrentWriteable.h" #import -@interface GRPCDelegateWrapper () +@interface GRXConcurrentWriteable () // These are atomic so that cancellation can nillify them from any thread. @property(atomic, strong) id writeable; @property(atomic, strong) GRXWriter *writer; @end -@implementation GRPCDelegateWrapper { +@implementation GRXConcurrentWriteable { dispatch_queue_t _writeableQueue; // This ensures that writesFinishedWithError: is only sent once to the writeable. dispatch_once_t _alreadyFinished;