OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" |
12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
13 #include "base/stl_util-inl.h" | 13 #include "base/stl_util-inl.h" |
14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
15 #include "base/string_split.h" | 15 #include "base/string_split.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
17 #include "base/threading/thread_restrictions.h" | 17 #include "base/threading/thread_restrictions.h" |
18 #include "chrome/browser/browser_thread.h" | 18 #include "chrome/browser/browser_thread.h" |
19 #include "chrome/browser/gpu_process_host.h" | 19 #include "chrome/browser/gpu_process_host.h" |
20 #include "chrome/browser/net/chrome_net_log.h" | 20 #include "chrome/browser/net/chrome_net_log.h" |
21 #include "chrome/browser/net/chrome_url_request_context.h" | 21 #include "chrome/browser/net/chrome_url_request_context.h" |
22 #include "chrome/browser/net/connect_interceptor.h" | 22 #include "chrome/browser/net/connect_interceptor.h" |
23 #include "chrome/browser/net/passive_log_collector.h" | 23 #include "chrome/browser/net/passive_log_collector.h" |
24 #include "chrome/browser/net/predictor_api.h" | 24 #include "chrome/browser/net/predictor_api.h" |
25 #include "chrome/browser/prefs/pref_service.h" | 25 #include "chrome/browser/prefs/pref_service.h" |
26 #include "chrome/browser/prerender/prerender_interceptor.h" | |
27 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/common/net/raw_host_resolver_proc.h" | 27 #include "chrome/common/net/raw_host_resolver_proc.h" |
29 #include "chrome/common/net/url_fetcher.h" | 28 #include "chrome/common/net/url_fetcher.h" |
30 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
31 #include "net/base/cert_verifier.h" | 30 #include "net/base/cert_verifier.h" |
32 #include "net/base/dnsrr_resolver.h" | 31 #include "net/base/dnsrr_resolver.h" |
33 #include "net/base/host_cache.h" | 32 #include "net/base/host_cache.h" |
34 #include "net/base/host_resolver.h" | 33 #include "net/base/host_resolver.h" |
35 #include "net/base/host_resolver_impl.h" | 34 #include "net/base/host_resolver_impl.h" |
36 #include "net/base/mapped_host_resolver.h" | 35 #include "net/base/mapped_host_resolver.h" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 globals_->proxy_script_fetcher_proxy_service.get(), | 343 globals_->proxy_script_fetcher_proxy_service.get(), |
345 globals_->ssl_config_service.get(), | 344 globals_->ssl_config_service.get(), |
346 new net::SpdySessionPool(globals_->ssl_config_service.get()), | 345 new net::SpdySessionPool(globals_->ssl_config_service.get()), |
347 globals_->http_auth_handler_factory.get(), | 346 globals_->http_auth_handler_factory.get(), |
348 &globals_->network_delegate, | 347 &globals_->network_delegate, |
349 net_log_)); | 348 net_log_)); |
350 | 349 |
351 scoped_refptr<URLRequestContext> proxy_script_fetcher_context = | 350 scoped_refptr<URLRequestContext> proxy_script_fetcher_context = |
352 ConstructProxyScriptFetcherContext(globals_, net_log_); | 351 ConstructProxyScriptFetcherContext(globals_, net_log_); |
353 globals_->proxy_script_fetcher_context = proxy_script_fetcher_context; | 352 globals_->proxy_script_fetcher_context = proxy_script_fetcher_context; |
354 | |
355 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
356 switches::kEnablePagePrerender)) { | |
357 prerender_interceptor_.reset(new PrerenderInterceptor()); | |
358 } | |
359 } | 353 } |
360 | 354 |
361 void IOThread::CleanUp() { | 355 void IOThread::CleanUp() { |
362 // Step 1: Kill all things that might be holding onto | 356 // Step 1: Kill all things that might be holding onto |
363 // net::URLRequest/URLRequestContexts. | 357 // net::URLRequest/URLRequestContexts. |
364 | 358 |
365 #if defined(USE_NSS) | 359 #if defined(USE_NSS) |
366 net::ShutdownOCSP(); | 360 net::ShutdownOCSP(); |
367 #endif // defined(USE_NSS) | 361 #endif // defined(USE_NSS) |
368 | 362 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 // IOThread now. | 396 // IOThread now. |
403 predictor_->Release(); | 397 predictor_->Release(); |
404 predictor_ = NULL; | 398 predictor_ = NULL; |
405 chrome_browser_net::FreePredictorResources(); | 399 chrome_browser_net::FreePredictorResources(); |
406 } | 400 } |
407 | 401 |
408 // Deletion will unregister this interceptor. | 402 // Deletion will unregister this interceptor. |
409 delete speculative_interceptor_; | 403 delete speculative_interceptor_; |
410 speculative_interceptor_ = NULL; | 404 speculative_interceptor_ = NULL; |
411 | 405 |
412 prerender_interceptor_.reset(); | |
413 | |
414 // TODO(eroman): hack for http://crbug.com/15513 | 406 // TODO(eroman): hack for http://crbug.com/15513 |
415 if (globals_->host_resolver->GetAsHostResolverImpl()) { | 407 if (globals_->host_resolver->GetAsHostResolverImpl()) { |
416 globals_->host_resolver.get()->GetAsHostResolverImpl()->Shutdown(); | 408 globals_->host_resolver.get()->GetAsHostResolverImpl()->Shutdown(); |
417 } | 409 } |
418 | 410 |
419 delete globals_; | 411 delete globals_; |
420 globals_ = NULL; | 412 globals_ = NULL; |
421 | 413 |
422 BrowserProcessSubThread::CleanUp(); | 414 BrowserProcessSubThread::CleanUp(); |
423 } | 415 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 net::HostCache* host_cache = | 506 net::HostCache* host_cache = |
515 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); | 507 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); |
516 if (host_cache) | 508 if (host_cache) |
517 host_cache->clear(); | 509 host_cache->clear(); |
518 } | 510 } |
519 // Clear all of the passively logged data. | 511 // Clear all of the passively logged data. |
520 // 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 |
521 // clear the data pertaining to off the record context. | 513 // clear the data pertaining to off the record context. |
522 net_log_->ClearAllPassivelyCapturedEvents(); | 514 net_log_->ClearAllPassivelyCapturedEvents(); |
523 } | 515 } |
OLD | NEW |