| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ios/crnet/crnet_environment.h" | 5 #include "ios/crnet/crnet_environment.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 GetHttpNetworkSession(GetMainContextGetter()->GetURLRequestContext()); | 246 GetHttpNetworkSession(GetMainContextGetter()->GetURLRequestContext()); |
| 247 | 247 |
| 248 if (http_network_session) { | 248 if (http_network_session) { |
| 249 net::SpdySessionPool *spdy_session_pool = | 249 net::SpdySessionPool *spdy_session_pool = |
| 250 http_network_session->spdy_session_pool(); | 250 http_network_session->spdy_session_pool(); |
| 251 if (spdy_session_pool) | 251 if (spdy_session_pool) |
| 252 spdy_session_pool->CloseCurrentSessions(net::ERR_ABORTED); | 252 spdy_session_pool->CloseCurrentSessions(net::ERR_ABORTED); |
| 253 } | 253 } |
| 254 } | 254 } |
| 255 | 255 |
| 256 CrNetEnvironment::CrNetEnvironment(std::string user_agent_product_name) | 256 CrNetEnvironment::CrNetEnvironment(const std::string& user_agent_product_name) |
| 257 : spdy_enabled_(false), | 257 : spdy_enabled_(false), |
| 258 quic_enabled_(false), | 258 quic_enabled_(false), |
| 259 sdch_enabled_(false), | 259 sdch_enabled_(false), |
| 260 main_context_(new net::URLRequestContext), | 260 main_context_(new net::URLRequestContext), |
| 261 user_agent_product_name_(user_agent_product_name), | 261 user_agent_product_name_(user_agent_product_name), |
| 262 net_log_(new net::NetLog) { | 262 net_log_(new net::NetLog) {} |
| 263 | |
| 264 } | |
| 265 | 263 |
| 266 void CrNetEnvironment::Install() { | 264 void CrNetEnvironment::Install() { |
| 267 // Threads setup. | 265 // Threads setup. |
| 268 network_cache_thread_.reset(new base::Thread("Chrome Network Cache Thread")); | 266 network_cache_thread_.reset(new base::Thread("Chrome Network Cache Thread")); |
| 269 network_cache_thread_->StartWithOptions( | 267 network_cache_thread_->StartWithOptions( |
| 270 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | 268 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
| 271 network_io_thread_.reset(new base::Thread("Chrome Network IO Thread")); | 269 network_io_thread_.reset(new base::Thread("Chrome Network IO Thread")); |
| 272 network_io_thread_->StartWithOptions( | 270 network_io_thread_->StartWithOptions( |
| 273 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | 271 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
| 274 file_thread_.reset(new base::Thread("Chrome File Thread")); | 272 file_thread_.reset(new base::Thread("Chrome File Thread")); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 if (backend) | 501 if (backend) |
| 504 backend->DoomAllEntries(client_callback); | 502 backend->DoomAllEntries(client_callback); |
| 505 }); | 503 }); |
| 506 int rc = cache->GetBackend(&backend, doom_callback); | 504 int rc = cache->GetBackend(&backend, doom_callback); |
| 507 if (rc != net::ERR_IO_PENDING) { | 505 if (rc != net::ERR_IO_PENDING) { |
| 508 // GetBackend doesn't call the callback if it completes synchronously, so | 506 // GetBackend doesn't call the callback if it completes synchronously, so |
| 509 // call it directly here. | 507 // call it directly here. |
| 510 doom_callback.Run(rc); | 508 doom_callback.Run(rc); |
| 511 } | 509 } |
| 512 } | 510 } |
| OLD | NEW |