clang-format

pull/16190/head
Muxi Yan 6 years ago
parent 5ae61f5a5a
commit fdf4b8f2f7
  1. 2
      src/objective-c/GRPCClient/GRPCCallOptions.h
  2. 3
      src/objective-c/GRPCClient/private/GRPCChannel.h
  3. 8
      src/objective-c/GRPCClient/private/GRPCChannel.m
  4. 7
      src/objective-c/GRPCClient/private/GRPCChannelPool.h
  5. 8
      src/objective-c/GRPCClient/private/GRPCChannelPool.m
  6. 14
      src/objective-c/ProtoRPC/ProtoRPC.m

@ -64,7 +64,7 @@ typedef NS_ENUM(NSUInteger, GRPCTransportType) {
* This method is called when gRPC is about to start the call. When OAuth token is acquired,
* \a handler is expected to be called with \a token being the new token to be used for this call.
*/
- (void)getTokenWithHandler:(void (^ _Nullable)(NSString * _Nullable token))handler;
- (void)getTokenWithHandler:(void (^_Nullable)(NSString *_Nullable token))handler;
@end
@interface GRPCCallOptions : NSObject<NSCopying, NSMutableCopying>

@ -51,7 +51,8 @@ NS_ASSUME_NONNULL_BEGIN
/** Acquire the dictionary of channel args with current configurations. */
@property(copy, readonly) NSDictionary *channelArgs;
- (nullable instancetype)initWithHost:(NSString *)host callOptions:(GRPCCallOptions *)callOptions NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithHost:(NSString *)host
callOptions:(GRPCCallOptions *)callOptions NS_DESIGNATED_INITIALIZER;
@end

@ -226,7 +226,7 @@
if (_unmanagedChannel == NULL) return NULL;
NSString *serverAuthority =
callOptions.transportType == GRPCTransportTypeCronet ? nil : callOptions.serverAuthority;
callOptions.transportType == GRPCTransportTypeCronet ? nil : callOptions.serverAuthority;
NSTimeInterval timeout = callOptions.timeout;
NSAssert(timeout >= 0, @"Invalid timeout");
if (timeout < 0) return NULL;
@ -236,9 +236,9 @@
}
grpc_slice path_slice = grpc_slice_from_copied_string(path.UTF8String);
gpr_timespec deadline_ms =
timeout == 0 ? gpr_inf_future(GPR_CLOCK_REALTIME)
: gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
gpr_time_from_millis((int64_t)(timeout * 1000), GPR_TIMESPAN));
timeout == 0 ? gpr_inf_future(GPR_CLOCK_REALTIME)
: gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
gpr_time_from_millis((int64_t)(timeout * 1000), GPR_TIMESPAN));
call = grpc_channel_create_call(_unmanagedChannel, NULL, GRPC_PROPAGATE_DEFAULTS,
queue.unmanagedQueue, path_slice,
serverAuthority ? &host_slice : NULL, deadline_ms, NULL);

@ -41,14 +41,15 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable instancetype)init NS_UNAVAILABLE;
+ (nullable instancetype)new NS_UNAVAILABLE;
+ (nullable instancetype) new NS_UNAVAILABLE;
/**
* Initialize with an actual channel object \a channel and a reference to the channel pool.
*/
- (nullable instancetype)initWithChannelConfiguration:
(GRPCChannelConfiguration *)channelConfiguration
channelPool:(GRPCChannelPool *)channelPool NS_DESIGNATED_INITIALIZER;
channelPool:(GRPCChannelPool *)channelPool
NS_DESIGNATED_INITIALIZER;
/**
* Create a grpc core call object (grpc_call) from this channel. If channel is disconnected, get a
@ -91,7 +92,7 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable instancetype)init NS_UNAVAILABLE;
+ (nullable instancetype)new NS_UNAVAILABLE;
+ (nullable instancetype) new NS_UNAVAILABLE;
/**
* Get the global channel pool.

@ -74,8 +74,9 @@ static const NSTimeInterval kDefaultChannelDestroyDelay = 30;
}
- (void)dealloc {
NSAssert([_unmanagedCalls count] == 0 && _wrappedChannel == nil, @"Pooled channel should only be"
"destroyed after the wrapped channel is destroyed");
NSAssert([_unmanagedCalls count] == 0 && _wrappedChannel == nil,
@"Pooled channel should only be"
"destroyed after the wrapped channel is destroyed");
}
- (grpc_call *)unmanagedCallWithPath:(NSString *)path
@ -183,7 +184,8 @@ static const NSTimeInterval kDefaultChannelDestroyDelay = 30;
+ (instancetype)sharedInstance {
dispatch_once(&gInitChannelPool, ^{
gChannelPool = [[GRPCChannelPool alloc] initInstanceWithDestroyDelay:kDefaultChannelDestroyDelay];
gChannelPool =
[[GRPCChannelPool alloc] initInstanceWithDestroyDelay:kDefaultChannelDestroyDelay];
NSAssert(gChannelPool != nil, @"Cannot initialize global channel pool.");
});
return gChannelPool;

@ -145,12 +145,12 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing
self->_handler = nil;
}
[copiedHandler closedWithTrailingMetadata:nil
error:[NSError errorWithDomain:kGRPCErrorDomain
code:GRPCErrorCodeCancelled
userInfo:@{
NSLocalizedDescriptionKey :
@"Canceled by app"
}]];
error:[NSError errorWithDomain:kGRPCErrorDomain
code:GRPCErrorCodeCancelled
userInfo:@{
NSLocalizedDescriptionKey :
@"Canceled by app"
}]];
});
} else {
_handler = nil;
@ -217,7 +217,7 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing
self->_handler = nil;
}
[copiedHandler closedWithTrailingMetadata:nil
error:ErrorForBadProto(message, _responseClass, error)];
error:ErrorForBadProto(message, _responseClass, error)];
});
[_call cancel];
_call = nil;

Loading…
Cancel
Save