OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/leak_tracker.h" | 10 #include "base/debug/leak_tracker.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 net::NetLog::Source(), | 169 net::NetLog::Source(), |
170 net::NetLog::PHASE_NONE, | 170 net::NetLog::PHASE_NONE, |
171 NULL); | 171 NULL); |
172 } | 172 } |
173 | 173 |
174 private: | 174 private: |
175 net::NetLog* net_log_; | 175 net::NetLog* net_log_; |
176 DISALLOW_COPY_AND_ASSIGN(LoggingNetworkChangeObserver); | 176 DISALLOW_COPY_AND_ASSIGN(LoggingNetworkChangeObserver); |
177 }; | 177 }; |
178 | 178 |
179 scoped_refptr<URLRequestContext> | 179 scoped_refptr<net::URLRequestContext> |
180 ConstructProxyScriptFetcherContext(IOThread::Globals* globals, | 180 ConstructProxyScriptFetcherContext(IOThread::Globals* globals, |
181 net::NetLog* net_log) { | 181 net::NetLog* net_log) { |
182 scoped_refptr<URLRequestContext> context(new URLRequestContext); | 182 scoped_refptr<net::URLRequestContext> context(new net::URLRequestContext); |
183 context->set_net_log(net_log); | 183 context->set_net_log(net_log); |
184 context->set_host_resolver(globals->host_resolver.get()); | 184 context->set_host_resolver(globals->host_resolver.get()); |
185 context->set_cert_verifier(globals->cert_verifier.get()); | 185 context->set_cert_verifier(globals->cert_verifier.get()); |
186 context->set_dnsrr_resolver(globals->dnsrr_resolver.get()); | 186 context->set_dnsrr_resolver(globals->dnsrr_resolver.get()); |
187 context->set_http_auth_handler_factory( | 187 context->set_http_auth_handler_factory( |
188 globals->http_auth_handler_factory.get()); | 188 globals->http_auth_handler_factory.get()); |
189 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); | 189 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); |
190 context->set_http_transaction_factory( | 190 context->set_http_transaction_factory( |
191 globals->proxy_script_fetcher_http_transaction_factory.get()); | 191 globals->proxy_script_fetcher_http_transaction_factory.get()); |
192 // In-memory cookie store. | 192 // In-memory cookie store. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 globals_->dnsrr_resolver.get(), | 340 globals_->dnsrr_resolver.get(), |
341 NULL /* dns_cert_checker */, | 341 NULL /* dns_cert_checker */, |
342 NULL /* ssl_host_info_factory */, | 342 NULL /* ssl_host_info_factory */, |
343 globals_->proxy_script_fetcher_proxy_service.get(), | 343 globals_->proxy_script_fetcher_proxy_service.get(), |
344 globals_->ssl_config_service.get(), | 344 globals_->ssl_config_service.get(), |
345 new net::SpdySessionPool(globals_->ssl_config_service.get()), | 345 new net::SpdySessionPool(globals_->ssl_config_service.get()), |
346 globals_->http_auth_handler_factory.get(), | 346 globals_->http_auth_handler_factory.get(), |
347 &globals_->network_delegate, | 347 &globals_->network_delegate, |
348 net_log_)); | 348 net_log_)); |
349 | 349 |
350 scoped_refptr<URLRequestContext> proxy_script_fetcher_context = | 350 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context = |
351 ConstructProxyScriptFetcherContext(globals_, net_log_); | 351 ConstructProxyScriptFetcherContext(globals_, net_log_); |
352 globals_->proxy_script_fetcher_context = proxy_script_fetcher_context; | 352 globals_->proxy_script_fetcher_context = proxy_script_fetcher_context; |
353 } | 353 } |
354 | 354 |
355 void IOThread::CleanUp() { | 355 void IOThread::CleanUp() { |
356 // Step 1: Kill all things that might be holding onto | 356 // Step 1: Kill all things that might be holding onto |
357 // net::URLRequest/URLRequestContexts. | 357 // net::URLRequest/net::URLRequestContexts. |
358 | 358 |
359 #if defined(USE_NSS) | 359 #if defined(USE_NSS) |
360 net::ShutdownOCSP(); | 360 net::ShutdownOCSP(); |
361 #endif // defined(USE_NSS) | 361 #endif // defined(USE_NSS) |
362 | 362 |
363 // Destroy all URLRequests started by URLFetchers. | 363 // Destroy all URLRequests started by URLFetchers. |
364 URLFetcher::CancelAll(); | 364 URLFetcher::CancelAll(); |
365 | 365 |
366 // If any child processes are still running, terminate them and | 366 // If any child processes are still running, terminate them and |
367 // and delete the BrowserChildProcessHost instances to release whatever | 367 // and delete the BrowserChildProcessHost instances to release whatever |
368 // IO thread only resources they are referencing. | 368 // IO thread only resources they are referencing. |
369 BrowserChildProcessHost::TerminateAll(); | 369 BrowserChildProcessHost::TerminateAll(); |
370 | 370 |
371 std::list<ChromeURLRequestContextGetter*> url_request_context_getters; | 371 std::list<ChromeURLRequestContextGetter*> url_request_context_getters; |
372 url_request_context_getters.swap(url_request_context_getters_); | 372 url_request_context_getters.swap(url_request_context_getters_); |
373 for (std::list<ChromeURLRequestContextGetter*>::iterator it = | 373 for (std::list<ChromeURLRequestContextGetter*>::iterator it = |
374 url_request_context_getters.begin(); | 374 url_request_context_getters.begin(); |
375 it != url_request_context_getters.end(); ++it) { | 375 it != url_request_context_getters.end(); ++it) { |
376 ChromeURLRequestContextGetter* getter = *it; | 376 ChromeURLRequestContextGetter* getter = *it; |
377 // Stop all pending certificate provenance check uploads | 377 // Stop all pending certificate provenance check uploads |
378 net::DnsCertProvenanceChecker* checker = | 378 net::DnsCertProvenanceChecker* checker = |
379 getter->GetURLRequestContext()->dns_cert_checker(); | 379 getter->GetURLRequestContext()->dns_cert_checker(); |
380 if (checker) | 380 if (checker) |
381 checker->Shutdown(); | 381 checker->Shutdown(); |
382 getter->ReleaseURLRequestContext(); | 382 getter->ReleaseURLRequestContext(); |
383 } | 383 } |
384 | 384 |
385 // Step 2: Release objects that the URLRequestContext could have been pointing | 385 // Step 2: Release objects that the net::URLRequestContext could have been |
386 // to. | 386 // pointing to. |
387 | 387 |
388 // This must be reset before the ChromeNetLog is destroyed. | 388 // This must be reset before the ChromeNetLog is destroyed. |
389 network_change_observer_.reset(); | 389 network_change_observer_.reset(); |
390 | 390 |
391 // Not initialized in Init(). May not be initialized. | 391 // Not initialized in Init(). May not be initialized. |
392 if (predictor_) { | 392 if (predictor_) { |
393 predictor_->Shutdown(); | 393 predictor_->Shutdown(); |
394 | 394 |
395 // TODO(willchan): Stop reference counting Predictor. It's owned by | 395 // TODO(willchan): Stop reference counting Predictor. It's owned by |
396 // IOThread now. | 396 // IOThread now. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 net::HostCache* host_cache = | 506 net::HostCache* host_cache = |
507 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); | 507 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); |
508 if (host_cache) | 508 if (host_cache) |
509 host_cache->clear(); | 509 host_cache->clear(); |
510 } | 510 } |
511 // Clear all of the passively logged data. | 511 // Clear all of the passively logged data. |
512 // TODO(eroman): this is a bit heavy handed, really all we need to do is | 512 // TODO(eroman): this is a bit heavy handed, really all we need to do is |
513 // clear the data pertaining to off the record context. | 513 // clear the data pertaining to off the record context. |
514 net_log_->ClearAllPassivelyCapturedEvents(); | 514 net_log_->ClearAllPassivelyCapturedEvents(); |
515 } | 515 } |
OLD | NEW |