OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 30 matching lines...) Expand all Loading... | |
41 #include "chrome/common/chrome_switches.h" | 41 #include "chrome/common/chrome_switches.h" |
42 #include "chrome/common/chrome_version_info.h" | 42 #include "chrome/common/chrome_version_info.h" |
43 #include "chrome/common/pref_names.h" | 43 #include "chrome/common/pref_names.h" |
44 #include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h" | 44 #include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h" |
45 #include "components/data_reduction_proxy/browser/http_auth_handler_data_reducti on_proxy.h" | 45 #include "components/data_reduction_proxy/browser/http_auth_handler_data_reducti on_proxy.h" |
46 #include "components/policy/core/common/policy_service.h" | 46 #include "components/policy/core/common/policy_service.h" |
47 #include "content/public/browser/browser_thread.h" | 47 #include "content/public/browser/browser_thread.h" |
48 #include "content/public/browser/cookie_store_factory.h" | 48 #include "content/public/browser/cookie_store_factory.h" |
49 #include "net/base/host_mapping_rules.h" | 49 #include "net/base/host_mapping_rules.h" |
50 #include "net/base/net_util.h" | 50 #include "net/base/net_util.h" |
51 #include "net/base/sdch_manager.h" | |
52 #include "net/cert/cert_verifier.h" | 51 #include "net/cert/cert_verifier.h" |
53 #include "net/cert/cert_verify_proc.h" | 52 #include "net/cert/cert_verify_proc.h" |
54 #include "net/cert/ct_known_logs.h" | 53 #include "net/cert/ct_known_logs.h" |
55 #include "net/cert/ct_verifier.h" | 54 #include "net/cert/ct_verifier.h" |
56 #include "net/cert/multi_threaded_cert_verifier.h" | 55 #include "net/cert/multi_threaded_cert_verifier.h" |
57 #include "net/cookies/cookie_store.h" | 56 #include "net/cookies/cookie_store.h" |
58 #include "net/dns/host_cache.h" | 57 #include "net/dns/host_cache.h" |
59 #include "net/dns/host_resolver.h" | 58 #include "net/dns/host_resolver.h" |
60 #include "net/dns/mapped_host_resolver.h" | 59 #include "net/dns/mapped_host_resolver.h" |
61 #include "net/ftp/ftp_network_layer.h" | 60 #include "net/ftp/ftp_network_layer.h" |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
414 // |local_state| is passed in explicitly in order to (1) reduce implicit | 413 // |local_state| is passed in explicitly in order to (1) reduce implicit |
415 // dependencies and (2) make IOThread more flexible for testing. | 414 // dependencies and (2) make IOThread more flexible for testing. |
416 IOThread::IOThread( | 415 IOThread::IOThread( |
417 PrefService* local_state, | 416 PrefService* local_state, |
418 policy::PolicyService* policy_service, | 417 policy::PolicyService* policy_service, |
419 ChromeNetLog* net_log, | 418 ChromeNetLog* net_log, |
420 extensions::EventRouterForwarder* extension_event_router_forwarder) | 419 extensions::EventRouterForwarder* extension_event_router_forwarder) |
421 : net_log_(net_log), | 420 : net_log_(net_log), |
422 extension_event_router_forwarder_(extension_event_router_forwarder), | 421 extension_event_router_forwarder_(extension_event_router_forwarder), |
423 globals_(NULL), | 422 globals_(NULL), |
424 sdch_manager_(NULL), | |
425 is_spdy_disabled_by_policy_(false), | 423 is_spdy_disabled_by_policy_(false), |
426 weak_factory_(this), | 424 weak_factory_(this), |
427 creation_time_(base::TimeTicks::Now()) { | 425 creation_time_(base::TimeTicks::Now()) { |
428 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes); | 426 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes); |
429 negotiate_disable_cname_lookup_ = local_state->GetBoolean( | 427 negotiate_disable_cname_lookup_ = local_state->GetBoolean( |
430 prefs::kDisableAuthNegotiateCnameLookup); | 428 prefs::kDisableAuthNegotiateCnameLookup); |
431 negotiate_enable_port_ = local_state->GetBoolean( | 429 negotiate_enable_port_ = local_state->GetBoolean( |
432 prefs::kEnableAuthNegotiatePort); | 430 prefs::kEnableAuthNegotiatePort); |
433 auth_server_whitelist_ = local_state->GetString(prefs::kAuthServerWhitelist); | 431 auth_server_whitelist_ = local_state->GetString(prefs::kAuthServerWhitelist); |
434 auth_delegate_whitelist_ = local_state->GetString( | 432 auth_delegate_whitelist_ = local_state->GetString( |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
692 job_factory.PassAs<net::URLRequestJobFactory>(); | 690 job_factory.PassAs<net::URLRequestJobFactory>(); |
693 | 691 |
694 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager()); | 692 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager()); |
695 globals_->throttler_manager->set_net_log(net_log_); | 693 globals_->throttler_manager->set_net_log(net_log_); |
696 // Always done in production, disabled only for unit tests. | 694 // Always done in production, disabled only for unit tests. |
697 globals_->throttler_manager->set_enable_thread_checks(true); | 695 globals_->throttler_manager->set_enable_thread_checks(true); |
698 | 696 |
699 globals_->proxy_script_fetcher_context.reset( | 697 globals_->proxy_script_fetcher_context.reset( |
700 ConstructProxyScriptFetcherContext(globals_, net_log_)); | 698 ConstructProxyScriptFetcherContext(globals_, net_log_)); |
701 | 699 |
702 sdch_manager_ = new net::SdchManager(); | |
703 | |
704 #if defined(OS_MACOSX) && !defined(OS_IOS) | 700 #if defined(OS_MACOSX) && !defined(OS_IOS) |
705 // Start observing Keychain events. This needs to be done on the UI thread, | 701 // Start observing Keychain events. This needs to be done on the UI thread, |
706 // as Keychain services requires a CFRunLoop. | 702 // as Keychain services requires a CFRunLoop. |
707 BrowserThread::PostTask(BrowserThread::UI, | 703 BrowserThread::PostTask(BrowserThread::UI, |
708 FROM_HERE, | 704 FROM_HERE, |
709 base::Bind(&ObserveKeychainEvents)); | 705 base::Bind(&ObserveKeychainEvents)); |
710 #endif | 706 #endif |
711 | 707 |
712 // InitSystemRequestContext turns right around and posts a task back | 708 // InitSystemRequestContext turns right around and posts a task back |
713 // to the IO thread, so we can't let it run until we know the IO | 709 // to the IO thread, so we can't let it run until we know the IO |
714 // thread has started. | 710 // thread has started. |
715 // | 711 // |
716 // Note that since we are at BrowserThread::Init time, the UI thread | 712 // Note that since we are at BrowserThread::Init time, the UI thread |
717 // is blocked waiting for the thread to start. Therefore, posting | 713 // is blocked waiting for the thread to start. Therefore, posting |
718 // this task to the main thread's message loop here is guaranteed to | 714 // this task to the main thread's message loop here is guaranteed to |
719 // get it onto the message loop while the IOThread object still | 715 // get it onto the message loop while the IOThread object still |
720 // exists. However, the message might not be processed on the UI | 716 // exists. However, the message might not be processed on the UI |
721 // thread until after IOThread is gone, so use a weak pointer. | 717 // thread until after IOThread is gone, so use a weak pointer. |
722 BrowserThread::PostTask(BrowserThread::UI, | 718 BrowserThread::PostTask(BrowserThread::UI, |
723 FROM_HERE, | 719 FROM_HERE, |
724 base::Bind(&IOThread::InitSystemRequestContext, | 720 base::Bind(&IOThread::InitSystemRequestContext, |
725 weak_factory_.GetWeakPtr())); | 721 weak_factory_.GetWeakPtr())); |
726 } | 722 } |
727 | 723 |
728 void IOThread::CleanUp() { | 724 void IOThread::CleanUp() { |
729 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks(); | 725 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks(); |
730 | 726 |
731 delete sdch_manager_; | |
732 sdch_manager_ = NULL; | |
733 | |
734 #if defined(USE_NSS) || defined(OS_IOS) | 727 #if defined(USE_NSS) || defined(OS_IOS) |
735 net::ShutdownNSSHttpIO(); | 728 net::ShutdownNSSHttpIO(); |
736 #endif | 729 #endif |
737 | 730 |
738 system_url_request_context_getter_ = NULL; | 731 system_url_request_context_getter_ = NULL; |
739 | 732 |
740 // Release objects that the net::URLRequestContext could have been pointing | 733 // Release objects that the net::URLRequestContext could have been pointing |
741 // to. | 734 // to. |
742 | 735 |
743 // Shutdown the HistogramWatcher on the IO thread. | 736 // Shutdown the HistogramWatcher on the IO thread. |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1051 system_params.net_log = net_log_; | 1044 system_params.net_log = net_log_; |
1052 system_params.proxy_service = globals_->system_proxy_service.get(); | 1045 system_params.proxy_service = globals_->system_proxy_service.get(); |
1053 | 1046 |
1054 globals_->system_http_transaction_factory.reset( | 1047 globals_->system_http_transaction_factory.reset( |
1055 new net::HttpNetworkLayer( | 1048 new net::HttpNetworkLayer( |
1056 new net::HttpNetworkSession(system_params))); | 1049 new net::HttpNetworkSession(system_params))); |
1057 globals_->system_url_request_job_factory.reset( | 1050 globals_->system_url_request_job_factory.reset( |
1058 new net::URLRequestJobFactoryImpl()); | 1051 new net::URLRequestJobFactoryImpl()); |
1059 globals_->system_request_context.reset( | 1052 globals_->system_request_context.reset( |
1060 ConstructSystemRequestContext(globals_, net_log_)); | 1053 ConstructSystemRequestContext(globals_, net_log_)); |
1061 | |
1062 sdch_manager_->set_sdch_fetcher( | |
1063 new SdchDictionaryFetcher( | |
mef
2014/06/18 17:30:30
So, where is fetcher now?
Randy Smith (Not in Mondays)
2014/06/18 17:39:25
http://src.chromium.org/viewvc/chrome/trunk/src/ch
| |
1064 sdch_manager_, system_url_request_context_getter_.get())); | |
1065 } | 1054 } |
1066 | 1055 |
1067 void IOThread::UpdateDnsClientEnabled() { | 1056 void IOThread::UpdateDnsClientEnabled() { |
1068 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); | 1057 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); |
1069 } | 1058 } |
1070 | 1059 |
1071 void IOThread::ConfigureQuic(const CommandLine& command_line) { | 1060 void IOThread::ConfigureQuic(const CommandLine& command_line) { |
1072 // Always fetch the field trial group to ensure it is reported correctly. | 1061 // Always fetch the field trial group to ensure it is reported correctly. |
1073 // The command line flags will be associated with a group that is reported | 1062 // The command line flags will be associated with a group that is reported |
1074 // so long as trial is actually queried. | 1063 // so long as trial is actually queried. |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1225 std::string version_flag = | 1214 std::string version_flag = |
1226 command_line.GetSwitchValueASCII(switches::kQuicVersion); | 1215 command_line.GetSwitchValueASCII(switches::kQuicVersion); |
1227 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1216 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1228 net::QuicVersion version = supported_versions[i]; | 1217 net::QuicVersion version = supported_versions[i]; |
1229 if (net::QuicVersionToString(version) == version_flag) { | 1218 if (net::QuicVersionToString(version) == version_flag) { |
1230 return version; | 1219 return version; |
1231 } | 1220 } |
1232 } | 1221 } |
1233 return net::QUIC_VERSION_UNSUPPORTED; | 1222 return net::QUIC_VERSION_UNSUPPORTED; |
1234 } | 1223 } |
OLD | NEW |