| Index: components/cronet/ios/Cronet.mm
|
| diff --git a/components/cronet/ios/Cronet.mm b/components/cronet/ios/Cronet.mm
|
| index acbd855528b38f5237143600bf428083d9d05b3e..567d4085b0bb5b78e7ca38c57d0715181fbf10ec 100644
|
| --- a/components/cronet/ios/Cronet.mm
|
| +++ b/components/cronet/ios/Cronet.mm
|
| @@ -149,8 +149,9 @@ class CronetHttpProtocolHandlerDelegate
|
| gAcceptLanguages = acceptLanguages;
|
| }
|
|
|
| +// TODO(lilyhoughton) this should either be removed, or made more sophisticated
|
| + (void)checkNotStarted {
|
| - CHECK(gChromeNet == NULL) << "Cronet is already started.";
|
| + CHECK(!gChromeNet.Get()) << "Cronet is already started.";
|
| }
|
|
|
| + (void)setHttp2Enabled:(BOOL)http2Enabled {
|
| @@ -210,10 +211,11 @@ class CronetHttpProtocolHandlerDelegate
|
| }
|
|
|
| + (void)startInternal {
|
| - cronet::CronetEnvironment::Initialize();
|
| std::string user_agent = base::SysNSStringToUTF8(gUserAgent);
|
| +
|
| gChromeNet.Get().reset(
|
| new cronet::CronetEnvironment(user_agent, gUserAgentPartial));
|
| +
|
| gChromeNet.Get()->set_accept_language(
|
| base::SysNSStringToUTF8(gAcceptLanguages ?: [self getAcceptLanguages]));
|
|
|
| @@ -244,12 +246,18 @@ class CronetHttpProtocolHandlerDelegate
|
| dispatch_once(&onceToken, ^{
|
| if (![NSThread isMainThread]) {
|
| dispatch_sync(dispatch_get_main_queue(), ^(void) {
|
| - [self startInternal];
|
| + cronet::CronetEnvironment::Initialize();
|
| });
|
| } else {
|
| - [self startInternal];
|
| + cronet::CronetEnvironment::Initialize();
|
| }
|
| });
|
| +
|
| + [self startInternal];
|
| +}
|
| +
|
| ++ (void)shutdownForTesting {
|
| + gChromeNet.Get().reset();
|
| }
|
|
|
| + (void)registerHttpProtocolHandler {
|
|
|