Style guide related feedback fixes.

pull/6586/head
Makarand Dharmapurikar 9 years ago
parent 6d2ed00a1a
commit aed1de9d2a
  1. 11
      src/objective-c/GRPCClient/GRPCCall+Cronet.h
  2. 16
      src/objective-c/GRPCClient/GRPCCall+Cronet.m
  3. 2
      src/objective-c/GRPCClient/private/GRPCChannel.m
  4. 4
      src/objective-c/GRPCClient/private/GRPCHost.m
  5. 10
      src/objective-c/tests/InteropTests.m

@ -39,9 +39,16 @@
*/
@interface GRPCCall (Cronet)
+(void)useCronet:(cronet_engine *)cronet_engine;
/* This method should be called before issuing the first RPC. It should be
* called only once. Create an instance of Cronet engine in your app elsewhere
* and pass the instance pointer in the cronet_engine parameter. Once set,
* all subsequent RPCs will use Cronet transport. The method is not thread
* safe.
*/
+(void)useCronetWithEngine:(cronet_engine *)engine;
+(void *)getCronetEngine;
+(cronet_engine *)cronetEngine;
+(BOOL)isUsingCronet;

@ -33,22 +33,22 @@
#import "GRPCCall+Cronet.h"
static BOOL use_cronet = NO;
static void *g_cronet_engine;
static BOOL useCronet = NO;
static cronet_engine *globalCronetEngine;
@implementation GRPCCall (Cronet)
+ (void)useCronet:(cronet_engine *)cronet_engine {
use_cronet = YES;
g_cronet_engine = cronet_engine;
+ (void)useCronetWithEngine:(cronet_engine *)engine {
useCronet = YES;
globalCronetEngine = engine;
}
+ (void *)getCronetEngine {
return g_cronet_engine;
+ (cronet_engine *)cronetEngine {
return globalCronetEngine;
}
+ (BOOL)isUsingCronet {
return use_cronet;
return useCronet;
}
@end

@ -154,7 +154,7 @@ grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) {
+ (GRPCChannel *)secureCronetChannelWithHost:(NSString *)host
channelArgs:(NSDictionary *)channelArgs {
void *engine = [GRPCCall getCronetEngine];
cronet_engine *engine = [GRPCCall cronetEngine];
if (!engine) {
[NSException raise:NSInvalidArgumentException
format:@"cronet_engine is NULL. Set it first."];

@ -201,14 +201,14 @@ NS_ASSUME_NONNULL_BEGIN
- (GRPCChannel *)newChannel {
NSDictionary *args = [self channelArgs];
BOOL use_cronet = [GRPCCall isUsingCronet];
BOOL useCronet = [GRPCCall isUsingCronet];
if (_secure) {
GRPCChannel *channel;
@synchronized(self) {
if (_channelCreds == nil) {
[self setTLSPEMRootCerts:nil withPrivateKey:nil withCertChain:nil error:nil];
}
if (use_cronet) {
if (useCronet) {
channel = [GRPCChannel secureCronetChannelWithHost:_address
channelArgs:args];
} else {

@ -80,7 +80,7 @@
#pragma mark Tests
static cronet_engine *_engine = NULL;
static cronet_engine *cronetEngine = NULL;
@implementation InteropTests {
RMTTestService *_service;
@ -93,12 +93,12 @@ static cronet_engine *_engine = NULL;
- (void)setUp {
_service = self.class.host ? [RMTTestService serviceWithHost:self.class.host] : nil;
#ifdef GRPC_COMPILE_WITH_CRONET
if (_engine == NULL) {
if (cronetEngine == NULL) {
// Cronet setup
[Cronet setHttp2Enabled:YES];
[Cronet setSslKeyLogFileName:@"cronetkeylogfile.pem"];
[Cronet start];
_engine = [Cronet getGlobalEngine];
[GRPCCall useCronet:_engine];
cronetEngine = [Cronet getGlobalEngine];
[GRPCCall useCronetWithEngine:cronetEngine];
}
#endif
}

Loading…
Cancel
Save