diff options
author | Muxi Yan <mxyan@google.com> | 2018-11-15 14:00:51 -0800 |
---|---|---|
committer | Muxi Yan <mxyan@google.com> | 2018-11-15 14:00:51 -0800 |
commit | 57464321214a5ce34e5de1868ce4eb3624ebdebb (patch) | |
tree | bd7ec38eeb26eff52fd605085377b46e0b3d3218 /src/objective-c | |
parent | 8a762d447813db1b1c3fe52b24e638581235460e (diff) |
Fix handler release - Part 1
Diffstat (limited to 'src/objective-c')
-rw-r--r-- | src/objective-c/GRPCClient/GRPCCall.h | 9 | ||||
-rw-r--r-- | src/objective-c/ProtoRPC/ProtoRPC.h | 7 | ||||
-rw-r--r-- | src/objective-c/tests/APIv2Tests/APIv2Tests.m | 24 | ||||
-rw-r--r-- | src/objective-c/tests/InteropTests.m | 24 |
4 files changed, 23 insertions, 41 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index fcda4dc8ac..7f80c17f1f 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -156,15 +156,13 @@ extern NSString *const kGRPCTrailersKey; @optional /** - * Issued when initial metadata is received from the server. The task must be scheduled onto the - * dispatch queue in property \a dispatchQueue. + * Issued when initial metadata is received from the server. */ - (void)receivedInitialMetadata:(nullable NSDictionary *)initialMetadata; /** * Issued when a message is received from the server. The message is the raw data received from the - * server, with decompression and without proto deserialization. The task must be scheduled onto the - * dispatch queue in property \a dispatchQueue. + * server, with decompression and without proto deserialization. */ - (void)receivedRawMessage:(nullable NSData *)message; @@ -172,8 +170,7 @@ extern NSString *const kGRPCTrailersKey; * Issued when a call finished. If the call finished successfully, \a error is nil and \a * trainingMetadata consists any trailing metadata received from the server. Otherwise, \a error * is non-nil and contains the corresponding error information, including gRPC error codes and - * error descriptions. The task must be scheduled onto the dispatch queue in property - * \a dispatchQueue. + * error descriptions. */ - (void)closedWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata error:(nullable NSError *)error; diff --git a/src/objective-c/ProtoRPC/ProtoRPC.h b/src/objective-c/ProtoRPC/ProtoRPC.h index dc776368a8..569aaa79e4 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.h +++ b/src/objective-c/ProtoRPC/ProtoRPC.h @@ -31,13 +31,11 @@ NS_ASSUME_NONNULL_BEGIN @optional /** - * Issued when initial metadata is received from the server. The task must be scheduled onto the - * dispatch queue in property \a dispatchQueue. */ + * Issued when initial metadata is received from the server. - (void)receivedInitialMetadata:(nullable NSDictionary *)initialMetadata; /** * Issued when a message is received from the server. The message is the deserialized proto object. - * The task must be scheduled onto the dispatch queue in property \a dispatchQueue. */ - (void)receivedProtoMessage:(nullable GPBMessage *)message; @@ -45,8 +43,7 @@ NS_ASSUME_NONNULL_BEGIN * Issued when a call finished. If the call finished successfully, \a error is nil and \a * trainingMetadata consists any trailing metadata received from the server. Otherwise, \a error * is non-nil and contains the corresponding error information, including gRPC error codes and - * error descriptions. The task must be scheduled onto the dispatch queue in property - * \a dispatchQueue. + * error descriptions. */ - (void)closedWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata error:(nullable NSError *)error; diff --git a/src/objective-c/tests/APIv2Tests/APIv2Tests.m b/src/objective-c/tests/APIv2Tests/APIv2Tests.m index 28f94cd8c7..e49f58ae9d 100644 --- a/src/objective-c/tests/APIv2Tests/APIv2Tests.m +++ b/src/objective-c/tests/APIv2Tests/APIv2Tests.m @@ -82,28 +82,22 @@ static const NSTimeInterval kTestTimeout = 16; } - (void)receivedInitialMetadata:(NSDictionary *_Nullable)initialMetadata { - dispatch_async(_dispatchQueue, ^{ - if (self->_initialMetadataCallback) { - self->_initialMetadataCallback(initialMetadata); - } - }); + if (self->_initialMetadataCallback) { + self->_initialMetadataCallback(initialMetadata); + } } - (void)receivedRawMessage:(GPBMessage *_Nullable)message { - dispatch_async(_dispatchQueue, ^{ - if (self->_messageCallback) { - self->_messageCallback(message); - } - }); + if (self->_messageCallback) { + self->_messageCallback(message); + } } - (void)closedWithTrailingMetadata:(NSDictionary *_Nullable)trailingMetadata error:(NSError *_Nullable)error { - dispatch_async(_dispatchQueue, ^{ - if (self->_closeCallback) { - self->_closeCallback(trailingMetadata, error); - } - }); + if (self->_closeCallback) { + self->_closeCallback(trailingMetadata, error); + } } - (dispatch_queue_t)dispatchQueue { diff --git a/src/objective-c/tests/InteropTests.m b/src/objective-c/tests/InteropTests.m index dcc8f1b589..8754bd5cca 100644 --- a/src/objective-c/tests/InteropTests.m +++ b/src/objective-c/tests/InteropTests.m @@ -103,28 +103,22 @@ BOOL isRemoteInteropTest(NSString *host) { } - (void)receivedInitialMetadata:(NSDictionary *)initialMetadata { - dispatch_async(_dispatchQueue, ^{ - if (_initialMetadataCallback) { - _initialMetadataCallback(initialMetadata); - } - }); + if (_initialMetadataCallback) { + _initialMetadataCallback(initialMetadata); + } } - (void)receivedProtoMessage:(GPBMessage *)message { - dispatch_async(_dispatchQueue, ^{ - if (_messageCallback) { - _messageCallback(message); - } - }); + if (_messageCallback) { + _messageCallback(message); + } } - (void)closedWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error { - dispatch_async(_dispatchQueue, ^{ - if (_closeCallback) { - _closeCallback(trailingMetadata, error); - } - }); + if (_closeCallback) { + _closeCallback(trailingMetadata, error); + } } - (dispatch_queue_t)dispatchQueue { |