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

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

Issue 2644583002: Add configuration functions for HTTP cache type to Obj-C and C++ (Closed)
Patch Set: make enum more obj-c-compatible Created 3 years, 11 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 | « components/cronet/ios/Cronet.h ('k') | components/cronet/ios/cronet_environment.h » ('j') | 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 09b3c53b60f21dd13b510ea559f75abd1f0ecb15..65d5e87ca5bf58408c01958f0187c7fd939e7eb9 100644
--- a/components/cronet/ios/Cronet.mm
+++ b/components/cronet/ios/Cronet.mm
@@ -33,6 +33,8 @@ base::LazyInstance<std::unique_ptr<cronet::CronetEnvironment>>::Leaky
BOOL gHttp2Enabled = YES;
BOOL gQuicEnabled = NO;
+cronet::URLRequestContextConfig::HttpCacheType gHttpCache =
+ cronet::URLRequestContextConfig::HttpCacheType::DISK;
ScopedVector<cronet::URLRequestContextConfig::QuicHint> gQuicHints;
NSString* gUserAgent = nil;
BOOL gUserAgentPartial = NO;
@@ -159,6 +161,23 @@ class CronetHttpProtocolHandlerDelegate
gSslKeyLogFileName = sslKeyLogFileName;
}
++ (void)setHttpCacheType:(CRNHttpCacheType)httpCacheType {
+ [self checkNotStarted];
+ switch (httpCacheType) {
+ case CRNHttpCacheTypeDisabled:
+ gHttpCache = cronet::URLRequestContextConfig::HttpCacheType::DISABLED;
+ break;
+ case CRNHttpCacheTypeDisk:
+ gHttpCache = cronet::URLRequestContextConfig::HttpCacheType::DISK;
+ break;
+ case CRNHttpCacheTypeMemory:
+ gHttpCache = cronet::URLRequestContextConfig::HttpCacheType::MEMORY;
+ break;
+ default:
+ DCHECK(NO) << "Invalid HTTP cache type: " << httpCacheType;
+ }
+}
+
+ (void)setRequestFilterBlock:(RequestFilterBlock)block {
if (gHttpProtocolHandlerDelegate.get())
gHttpProtocolHandlerDelegate.get()->SetRequestFilterBlock(block);
@@ -176,6 +195,7 @@ class CronetHttpProtocolHandlerDelegate
gChromeNet.Get()->set_http2_enabled(gHttp2Enabled);
gChromeNet.Get()->set_quic_enabled(gQuicEnabled);
+ gChromeNet.Get()->set_http_cache(gHttpCache);
gChromeNet.Get()->set_ssl_key_log_file_name(
base::SysNSStringToUTF8(gSslKeyLogFileName));
for (const auto* quicHint : gQuicHints) {
« no previous file with comments | « components/cronet/ios/Cronet.h ('k') | components/cronet/ios/cronet_environment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698