Fix handler release - Part 1

pull/16190/head
Muxi Yan 6 years ago
parent 8a762d4478
commit 5746432121
  1. 9
      src/objective-c/GRPCClient/GRPCCall.h
  2. 7
      src/objective-c/ProtoRPC/ProtoRPC.h
  3. 24
      src/objective-c/tests/APIv2Tests/APIv2Tests.m
  4. 24
      src/objective-c/tests/InteropTests.m

@ -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;

@ -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;

@ -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 {

@ -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 {

Loading…
Cancel
Save