Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Unified Diff: components/cronet/ios/Cronet.mm

Issue 2778743010: [Cronet] Leak CronetHttpProtocolHandlerDelegate on shutdown. (Closed)
Patch Set: Removed shutdownForTesting and registered_ flag. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cronet/ios/Cronet.mm
diff --git a/components/cronet/ios/Cronet.mm b/components/cronet/ios/Cronet.mm
index b6aaeb13eab15f2d59f7f9b3bfd0db6a5aafc4f4..b883049b52d3fefab00ba5ac7b4ec128cc676e90 100644
--- a/components/cronet/ios/Cronet.mm
+++ b/components/cronet/ios/Cronet.mm
@@ -41,7 +41,8 @@ NSString* gUserAgent = nil;
BOOL gUserAgentPartial = NO;
NSString* gSslKeyLogFileName = nil;
RequestFilterBlock gRequestFilterBlock = nil;
-std::unique_ptr<CronetHttpProtocolHandlerDelegate> gHttpProtocolHandlerDelegate;
+base::LazyInstance<std::unique_ptr<CronetHttpProtocolHandlerDelegate>>::Leaky
+ gHttpProtocolHandlerDelegate = LAZY_INSTANCE_INITIALIZER;
NSURLCache* gPreservedSharedURLCache = nil;
BOOL gEnableTestCertVerifierForTesting = FALSE;
NSString* gAcceptLanguages = nil;
@@ -196,8 +197,8 @@ class CronetHttpProtocolHandlerDelegate
}
+ (void)setRequestFilterBlock:(RequestFilterBlock)block {
- if (gHttpProtocolHandlerDelegate.get())
- gHttpProtocolHandlerDelegate.get()->SetRequestFilterBlock(block);
+ if (gHttpProtocolHandlerDelegate.Get().get())
+ gHttpProtocolHandlerDelegate.Get().get()->SetRequestFilterBlock(block);
else
gRequestFilterBlock = block;
}
@@ -222,10 +223,11 @@ class CronetHttpProtocolHandlerDelegate
[self configureCronetEnvironmentForTesting:gChromeNet.Get().get()];
gChromeNet.Get()->Start();
- gHttpProtocolHandlerDelegate.reset(new CronetHttpProtocolHandlerDelegate(
- gChromeNet.Get()->GetURLRequestContextGetter(), gRequestFilterBlock));
+ gHttpProtocolHandlerDelegate.Get().reset(
+ new CronetHttpProtocolHandlerDelegate(
+ gChromeNet.Get()->GetURLRequestContextGetter(), gRequestFilterBlock));
net::HTTPProtocolHandlerDelegate::SetInstance(
- gHttpProtocolHandlerDelegate.get());
+ gHttpProtocolHandlerDelegate.Get().get());
gRequestFilterBlock = nil;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698