diff options
author | 2016-05-25 10:38:56 -0700 | |
---|---|---|
committer | 2016-05-25 10:38:56 -0700 | |
commit | de733bd78ce8c1390fa8553dd145b304178c23f4 (patch) | |
tree | 7220ea66cd8da139678cba84d1b0a223f5e69b1b /src/objective-c/GRPCClient | |
parent | 9b5f64019e5d9fd631184f37c42d923fe1745096 (diff) |
Cosmetic changes to address feedback.
Diffstat (limited to 'src/objective-c/GRPCClient')
-rw-r--r-- | src/objective-c/GRPCClient/GRPCCall+Cronet.h | 6 | ||||
-rw-r--r-- | src/objective-c/GRPCClient/GRPCCall+Cronet.m | 4 | ||||
-rw-r--r-- | src/objective-c/GRPCClient/private/GRPCChannel.h | 2 | ||||
-rw-r--r-- | src/objective-c/GRPCClient/private/GRPCChannel.m | 13 |
4 files changed, 15 insertions, 10 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCall+Cronet.h b/src/objective-c/GRPCClient/GRPCCall+Cronet.h index 85ea38ae00..e63aaec94f 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Cronet.h +++ b/src/objective-c/GRPCClient/GRPCCall+Cronet.h @@ -30,15 +30,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ +#import <Cronet/Cronet.h> + #import "GRPCCall.h" /** - * TODOTODOTODO: Description + * Methods for using cronet transport. */ @interface GRPCCall (Cronet) +(void) setUseCronet:(BOOL) useCronet - :(void *)cronet_engine; + :(cronet_engine *)cronet_engine; +(void *)getCronetEngine; diff --git a/src/objective-c/GRPCClient/GRPCCall+Cronet.m b/src/objective-c/GRPCClient/GRPCCall+Cronet.m index 87c02e61bf..17d6254a47 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Cronet.m +++ b/src/objective-c/GRPCClient/GRPCCall+Cronet.m @@ -33,13 +33,13 @@ #import "GRPCCall+Cronet.h" -static BOOL use_cronet = false; +static BOOL use_cronet = NO; static void *g_cronet_engine; @implementation GRPCCall (Cronet) + (void)setUseCronet:(BOOL)useCronet - :(void *)cronet_engine { + :(cronet_engine *)cronet_engine { use_cronet = useCronet; g_cronet_engine = cronet_engine; } diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.h b/src/objective-c/GRPCClient/private/GRPCChannel.h index f5e973104c..3219835d02 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.h +++ b/src/objective-c/GRPCClient/private/GRPCChannel.h @@ -59,7 +59,7 @@ struct grpc_channel_credentials; * Creates a secure channel to the specified @c host using Cronet as a transport mechanism. */ + (nullable GRPCChannel *)secureCronetChannelWithHost:(NSString *)host - channelArgs:(NSDictionary *)channelArgs; + channelArgs:(NSDictionary *)channelArgs; /** * Creates a secure channel to the specified @c host using the specified @c credentials and diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m index 2be3b2125f..412e8b01fb 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -38,6 +38,8 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> + +#import <Cronet/Cronet.h> #import <GRPCClient/GRPCCall+Cronet.h> #import "GRPCCompletionQueue.h" @@ -100,8 +102,8 @@ grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) { grpc_channel_args *_channelArgs; } -- (instancetype)initWithHostUsingCronet:(NSString *)host - engine:(void *)engine +- (instancetype)initWithHost:(NSString *)host + cronetEngine:(cronet_engine *)cronetEngine channelArgs:(NSDictionary *)channelArgs { if (!host) { [NSException raise:NSInvalidArgumentException format:@"host argument missing"]; @@ -110,7 +112,7 @@ grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) { if (self = [super init]) { _channelArgs = buildChannelArgs(channelArgs); _host = [host copy]; - _unmanagedChannel = grpc_cronet_secure_channel_create(engine, _host.UTF8String, _channelArgs, + _unmanagedChannel = grpc_cronet_secure_channel_create(cronetEngine, _host.UTF8String, _channelArgs, NULL); } @@ -154,10 +156,11 @@ grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) { channelArgs:(NSDictionary *)channelArgs { void *engine = [GRPCCall getCronetEngine]; if (!engine) { - [NSException raise:NSInvalidArgumentException format:@"cronet_engine is NULL. Set it first."]; + [NSException raise:NSInvalidArgumentException + format:@"cronet_engine is NULL. Set it first."]; return nil; } - return [[GRPCChannel alloc] initWithHostUsingCronet:host engine:engine channelArgs:channelArgs]; + return [[GRPCChannel alloc] initWithHost:host cronetEngine:engine channelArgs:channelArgs]; } + (GRPCChannel *)secureChannelWithHost:(NSString *)host { |