Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 int port, | 206 int port, |
| 207 int alternate_port) { | 207 int alternate_port) { |
| 208 DCHECK(port == alternate_port); | 208 DCHECK(port == alternate_port); |
| 209 quic_hints_.push_back(net::HostPortPair(host, port)); | 209 quic_hints_.push_back(net::HostPortPair(host, port)); |
| 210 } | 210 } |
| 211 | 211 |
| 212 CronetEnvironment::CronetEnvironment(const std::string& user_agent, | 212 CronetEnvironment::CronetEnvironment(const std::string& user_agent, |
| 213 bool user_agent_partial) | 213 bool user_agent_partial) |
| 214 : http2_enabled_(false), | 214 : http2_enabled_(false), |
| 215 quic_enabled_(false), | 215 quic_enabled_(false), |
| 216 quic_user_agent_id_(""), | |
|
mef
2016/12/12 21:52:20
std::string is initialized to empty string by defa
lilyhoughton
2016/12/13 15:10:22
Done.
| |
| 216 user_agent_(user_agent), | 217 user_agent_(user_agent), |
| 217 user_agent_partial_(user_agent_partial), | 218 user_agent_partial_(user_agent_partial), |
| 218 net_log_(new net::NetLog) {} | 219 net_log_(new net::NetLog) {} |
| 219 | 220 |
| 220 void CronetEnvironment::Start() { | 221 void CronetEnvironment::Start() { |
| 221 // Threads setup. | 222 // Threads setup. |
| 222 network_cache_thread_.reset(new base::Thread("Chrome Network Cache Thread")); | 223 network_cache_thread_.reset(new base::Thread("Chrome Network Cache Thread")); |
| 223 network_cache_thread_->StartWithOptions( | 224 network_cache_thread_->StartWithOptions( |
| 224 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | 225 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
| 225 network_io_thread_.reset(new base::Thread("Chrome Network IO Thread")); | 226 network_io_thread_.reset(new base::Thread("Chrome Network IO Thread")); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 user_agent_ = web::BuildUserAgentFromProduct(user_agent_); | 265 user_agent_ = web::BuildUserAgentFromProduct(user_agent_); |
| 265 | 266 |
| 266 // Cache | 267 // Cache |
| 267 base::FilePath cache_path; | 268 base::FilePath cache_path; |
| 268 if (!PathService::Get(base::DIR_CACHE, &cache_path)) | 269 if (!PathService::Get(base::DIR_CACHE, &cache_path)) |
| 269 return; | 270 return; |
| 270 cache_path = cache_path.Append(FILE_PATH_LITERAL("cronet")); | 271 cache_path = cache_path.Append(FILE_PATH_LITERAL("cronet")); |
| 271 | 272 |
| 272 std::unique_ptr<URLRequestContextConfig> config(new URLRequestContextConfig( | 273 std::unique_ptr<URLRequestContextConfig> config(new URLRequestContextConfig( |
| 273 quic_enabled_, // Enable QUIC. | 274 quic_enabled_, // Enable QUIC. |
| 274 "", // QUIC User Agent ID. | 275 quic_user_agent_id_, // QUIC User Agent ID. |
|
mef
2016/12/12 21:52:20
could call getDefault... here if |quic_user_agent_
lilyhoughton
2016/12/13 15:10:22
It should also check if |quic_enabled_| is true, t
mef
2016/12/13 20:46:43
Yes, good point.
| |
| 275 http2_enabled_, // Enable SPDY. | 276 http2_enabled_, // Enable SPDY. |
| 276 false, // Enable SDCH | 277 false, // Enable SDCH |
| 277 URLRequestContextConfig::DISK, // Type of http cache. | 278 URLRequestContextConfig::DISK, // Type of http cache. |
| 278 0, // Max size of http cache in bytes. | 279 0, // Max size of http cache in bytes. |
| 279 false, // Disable caching for HTTP responses. | 280 false, // Disable caching for HTTP responses. |
| 280 cache_path.value(), // Storage path for http cache and cookie storage. | 281 cache_path.value(), // Storage path for http cache and cookie storage. |
| 281 user_agent_, // User-Agent request header field. | 282 user_agent_, // User-Agent request header field. |
| 282 "{}", // JSON encoded experimental options. | 283 "{}", // JSON encoded experimental options. |
| 283 "", // Data reduction proxy key. | 284 "", // Data reduction proxy key. |
| 284 "", // Data reduction proxy. | 285 "", // Data reduction proxy. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 352 | 353 |
| 353 void CronetEnvironment::SetHostResolverRulesOnNetworkThread( | 354 void CronetEnvironment::SetHostResolverRulesOnNetworkThread( |
| 354 const std::string& rules, | 355 const std::string& rules, |
| 355 base::WaitableEvent* event) { | 356 base::WaitableEvent* event) { |
| 356 static_cast<net::MappedHostResolver*>(main_context_->host_resolver()) | 357 static_cast<net::MappedHostResolver*>(main_context_->host_resolver()) |
| 357 ->SetRulesFromString(rules); | 358 ->SetRulesFromString(rules); |
| 358 event->Signal(); | 359 event->Signal(); |
| 359 } | 360 } |
| 360 | 361 |
| 361 } // namespace cronet | 362 } // namespace cronet |
| OLD | NEW |