| Index: components/cronet/ios/Cronet.mm
|
| diff --git a/components/cronet/ios/Cronet.mm b/components/cronet/ios/Cronet.mm
|
| index b883049b52d3fefab00ba5ac7b4ec128cc676e90..1bbe6536641c41d18852ecba1144df080550842f 100644
|
| --- a/components/cronet/ios/Cronet.mm
|
| +++ b/components/cronet/ios/Cronet.mm
|
| @@ -148,8 +148,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 {
|
| @@ -204,10 +205,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]));
|
|
|
| @@ -236,12 +238,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)shutdown {
|
| + gChromeNet.Get().reset();
|
| }
|
|
|
| + (void)registerHttpProtocolHandler {
|
|
|