OLD | NEW |
1 // Copyright (c) 2011 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/bind.h" | 10 #include "base/bind.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "chrome/browser/net/chrome_network_delegate.h" | 25 #include "chrome/browser/net/chrome_network_delegate.h" |
26 #include "chrome/browser/net/chrome_url_request_context.h" | 26 #include "chrome/browser/net/chrome_url_request_context.h" |
27 #include "chrome/browser/net/connect_interceptor.h" | 27 #include "chrome/browser/net/connect_interceptor.h" |
28 #include "chrome/browser/net/passive_log_collector.h" | 28 #include "chrome/browser/net/passive_log_collector.h" |
29 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 29 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
30 #include "chrome/browser/net/proxy_service_factory.h" | 30 #include "chrome/browser/net/proxy_service_factory.h" |
31 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | 31 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
32 #include "chrome/browser/prefs/pref_service.h" | 32 #include "chrome/browser/prefs/pref_service.h" |
33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
34 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
35 #include "content/browser/gpu/gpu_process_host.h" | |
36 #include "content/browser/in_process_webkit/indexed_db_key_utility_client.h" | |
37 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
38 #include "content/public/common/content_client.h" | 36 #include "content/public/common/content_client.h" |
39 #include "content/public/common/url_fetcher.h" | 37 #include "content/public/common/url_fetcher.h" |
40 #include "net/base/cert_verifier.h" | 38 #include "net/base/cert_verifier.h" |
41 #include "net/base/cookie_monster.h" | 39 #include "net/base/cookie_monster.h" |
42 #include "net/base/default_origin_bound_cert_store.h" | 40 #include "net/base/default_origin_bound_cert_store.h" |
43 #include "net/base/host_cache.h" | 41 #include "net/base/host_cache.h" |
44 #include "net/base/host_resolver.h" | 42 #include "net/base/host_resolver.h" |
45 #include "net/base/host_resolver_impl.h" | 43 #include "net/base/host_resolver_impl.h" |
46 #include "net/base/mapped_host_resolver.h" | 44 #include "net/base/mapped_host_resolver.h" |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 // We constructed the weak pointer on the IO thread but it will be | 469 // We constructed the weak pointer on the IO thread but it will be |
472 // used on the UI thread. Call this to avoid a thread checker | 470 // used on the UI thread. Call this to avoid a thread checker |
473 // error. | 471 // error. |
474 weak_factory_.DetachFromThread(); | 472 weak_factory_.DetachFromThread(); |
475 } | 473 } |
476 | 474 |
477 void IOThread::CleanUp() { | 475 void IOThread::CleanUp() { |
478 delete sdch_manager_; | 476 delete sdch_manager_; |
479 sdch_manager_ = NULL; | 477 sdch_manager_ = NULL; |
480 | 478 |
481 // Step 1: Kill all things that might be holding onto | |
482 // net::URLRequest/net::URLRequestContexts. | |
483 | |
484 #if defined(USE_NSS) | 479 #if defined(USE_NSS) |
485 net::ShutdownOCSP(); | 480 net::ShutdownOCSP(); |
486 #endif // defined(USE_NSS) | 481 #endif // defined(USE_NSS) |
487 | 482 |
488 // Destroy all URLRequests started by URLFetchers. | |
489 content::URLFetcher::CancelAll(); | |
490 | |
491 IndexedDBKeyUtilityClient::Shutdown(); | |
492 | |
493 // If any child processes are still running, terminate them and | |
494 // and delete the BrowserChildProcessHost instances to release whatever | |
495 // IO thread only resources they are referencing. | |
496 BrowserChildProcessHost::TerminateAll(); | |
497 | |
498 system_url_request_context_getter_ = NULL; | 483 system_url_request_context_getter_ = NULL; |
499 | 484 |
500 // Step 2: Release objects that the net::URLRequestContext could have been | 485 // Release objects that the net::URLRequestContext could have been pointing |
501 // pointing to. | 486 // to. |
502 | 487 |
503 // This must be reset before the ChromeNetLog is destroyed. | 488 // This must be reset before the ChromeNetLog is destroyed. |
504 network_change_observer_.reset(); | 489 network_change_observer_.reset(); |
505 | 490 |
506 system_proxy_config_service_.reset(); | 491 system_proxy_config_service_.reset(); |
507 | 492 |
508 delete globals_; | 493 delete globals_; |
509 globals_ = NULL; | 494 globals_ = NULL; |
510 | 495 |
511 // net::URLRequest instances must NOT outlive the IO thread. | |
512 base::debug::LeakTracker<net::URLRequest>::CheckForLeaks(); | |
513 | |
514 base::debug::LeakTracker<SystemURLRequestContextGetter>::CheckForLeaks(); | 496 base::debug::LeakTracker<SystemURLRequestContextGetter>::CheckForLeaks(); |
515 } | 497 } |
516 | 498 |
517 // static | 499 // static |
518 void IOThread::RegisterPrefs(PrefService* local_state) { | 500 void IOThread::RegisterPrefs(PrefService* local_state) { |
519 local_state->RegisterStringPref(prefs::kAuthSchemes, | 501 local_state->RegisterStringPref(prefs::kAuthSchemes, |
520 "basic,digest,ntlm,negotiate"); | 502 "basic,digest,ntlm,negotiate"); |
521 local_state->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, | 503 local_state->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, |
522 false); | 504 false); |
523 local_state->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); | 505 local_state->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 system_params.network_delegate = globals_->system_network_delegate.get(); | 614 system_params.network_delegate = globals_->system_network_delegate.get(); |
633 system_params.net_log = net_log_; | 615 system_params.net_log = net_log_; |
634 globals_->system_http_transaction_factory.reset( | 616 globals_->system_http_transaction_factory.reset( |
635 new net::HttpNetworkLayer( | 617 new net::HttpNetworkLayer( |
636 new net::HttpNetworkSession(system_params))); | 618 new net::HttpNetworkSession(system_params))); |
637 globals_->system_ftp_transaction_factory.reset( | 619 globals_->system_ftp_transaction_factory.reset( |
638 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 620 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
639 globals_->system_request_context = | 621 globals_->system_request_context = |
640 ConstructSystemRequestContext(globals_, net_log_); | 622 ConstructSystemRequestContext(globals_, net_log_); |
641 } | 623 } |
OLD | NEW |