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

Side by Side Diff: components/cronet/ios/cronet_environment.mm

Issue 2760073002: [cronet] Expose API to set experimental options (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/cronet/ios/cronet_environment.h" 5 #include "components/cronet/ios/cronet_environment.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/atomicops.h" 10 #include "base/atomicops.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 int port, 214 int port,
215 int alternate_port) { 215 int alternate_port) {
216 DCHECK(port == alternate_port); 216 DCHECK(port == alternate_port);
217 quic_hints_.push_back(net::HostPortPair(host, port)); 217 quic_hints_.push_back(net::HostPortPair(host, port));
218 } 218 }
219 219
220 CronetEnvironment::CronetEnvironment(const std::string& user_agent, 220 CronetEnvironment::CronetEnvironment(const std::string& user_agent,
221 bool user_agent_partial) 221 bool user_agent_partial)
222 : http2_enabled_(false), 222 : http2_enabled_(false),
223 quic_enabled_(false), 223 quic_enabled_(false),
224 experimental_options_("{}"),
mef 2017/03/21 20:44:57 nit: I don't think this is necessary as it is cove
lilyhoughton 2017/03/22 13:40:55 Done. Should I have Obj-C default be an empty str
mef 2017/03/22 19:18:26 I think so. It seems that on Android they default
224 http_cache_(URLRequestContextConfig::HttpCacheType::DISK), 225 http_cache_(URLRequestContextConfig::HttpCacheType::DISK),
225 user_agent_(user_agent), 226 user_agent_(user_agent),
226 user_agent_partial_(user_agent_partial), 227 user_agent_partial_(user_agent_partial),
227 net_log_(new net::NetLog) {} 228 net_log_(new net::NetLog) {}
228 229
229 void CronetEnvironment::Start() { 230 void CronetEnvironment::Start() {
230 // Threads setup. 231 // Threads setup.
231 network_cache_thread_.reset(new base::Thread("Chrome Network Cache Thread")); 232 network_cache_thread_.reset(new base::Thread("Chrome Network Cache Thread"));
232 network_cache_thread_->StartWithOptions( 233 network_cache_thread_->StartWithOptions(
233 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); 234 base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 cache_path = cache_path.Append(FILE_PATH_LITERAL("cronet")); 287 cache_path = cache_path.Append(FILE_PATH_LITERAL("cronet"));
287 288
288 URLRequestContextConfigBuilder context_config_builder; 289 URLRequestContextConfigBuilder context_config_builder;
289 context_config_builder.enable_quic = quic_enabled_; // Enable QUIC. 290 context_config_builder.enable_quic = quic_enabled_; // Enable QUIC.
290 context_config_builder.enable_spdy = http2_enabled_; // Enable HTTP/2. 291 context_config_builder.enable_spdy = http2_enabled_; // Enable HTTP/2.
291 context_config_builder.http_cache = http_cache_; // Set HTTP cache 292 context_config_builder.http_cache = http_cache_; // Set HTTP cache
292 context_config_builder.storage_path = 293 context_config_builder.storage_path =
293 cache_path.value(); // Storage path for http cache and cookie storage. 294 cache_path.value(); // Storage path for http cache and cookie storage.
294 context_config_builder.user_agent = 295 context_config_builder.user_agent =
295 user_agent_; // User-Agent request header field. 296 user_agent_; // User-Agent request header field.
297 context_config_builder.experimental_options =
mef 2017/03/21 20:44:58 I think we also need to do something similar to Cr
lilyhoughton 2017/03/22 13:40:55 Acknowledged.
298 experimental_options_; // Set experimental Cronet options.
296 context_config_builder.mock_cert_verifier = std::move( 299 context_config_builder.mock_cert_verifier = std::move(
297 mock_cert_verifier_); // MockCertVerifier to use for testing purposes. 300 mock_cert_verifier_); // MockCertVerifier to use for testing purposes.
298 std::unique_ptr<URLRequestContextConfig> config = 301 std::unique_ptr<URLRequestContextConfig> config =
299 context_config_builder.Build(); 302 context_config_builder.Build();
300 303
301 net::URLRequestContextBuilder context_builder; 304 net::URLRequestContextBuilder context_builder;
302 305
303 context_builder.set_accept_language(accept_language_); 306 context_builder.set_accept_language(accept_language_);
304 307
305 config->ConfigureURLRequestContextBuilder(&context_builder, net_log_.get(), 308 config->ConfigureURLRequestContextBuilder(&context_builder, net_log_.get(),
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 event->Signal(); 379 event->Signal();
377 } 380 }
378 381
379 std::string CronetEnvironment::getDefaultQuicUserAgentId() const { 382 std::string CronetEnvironment::getDefaultQuicUserAgentId() const {
380 return base::SysNSStringToUTF8([[NSBundle mainBundle] 383 return base::SysNSStringToUTF8([[NSBundle mainBundle]
381 objectForInfoDictionaryKey:@"CFBundleDisplayName"]) + 384 objectForInfoDictionaryKey:@"CFBundleDisplayName"]) +
382 " Cronet/" + CRONET_VERSION; 385 " Cronet/" + CRONET_VERSION;
383 } 386 }
384 387
385 } // namespace cronet 388 } // namespace cronet
OLDNEW
« components/cronet/ios/cronet_environment.h ('K') | « components/cronet/ios/cronet_environment.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698