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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 #include "url/url_constants.h" | 89 #include "url/url_constants.h" |
90 | 90 |
91 #if defined(ENABLE_CONFIGURATION_POLICY) | 91 #if defined(ENABLE_CONFIGURATION_POLICY) |
92 #include "policy/policy_constants.h" | 92 #include "policy/policy_constants.h" |
93 #endif | 93 #endif |
94 | 94 |
95 #if defined(ENABLE_EXTENSIONS) | 95 #if defined(ENABLE_EXTENSIONS) |
96 #include "chrome/browser/extensions/event_router_forwarder.h" | 96 #include "chrome/browser/extensions/event_router_forwarder.h" |
97 #endif | 97 #endif |
98 | 98 |
99 #if defined(USE_NSS) || defined(OS_IOS) | 99 #if defined(USE_NSS_CERTS) || defined(OS_IOS) |
100 #include "net/cert_net/nss_ocsp.h" | 100 #include "net/cert_net/nss_ocsp.h" |
101 #endif | 101 #endif |
102 | 102 |
103 #if defined(OS_ANDROID) | 103 #if defined(OS_ANDROID) |
104 #include "base/android/build_info.h" | 104 #include "base/android/build_info.h" |
105 #endif | 105 #endif |
106 | 106 |
107 #if defined(OS_CHROMEOS) | 107 #if defined(OS_CHROMEOS) |
108 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" | 108 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" |
109 #include "chromeos/network/host_resolver_impl_chromeos.h" | 109 #include "chromeos/network/host_resolver_impl_chromeos.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 void ObserveKeychainEvents() { | 145 void ObserveKeychainEvents() { |
146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
147 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents(); | 147 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents(); |
148 } | 148 } |
149 #endif | 149 #endif |
150 | 150 |
151 // Used for the "system" URLRequestContext. | 151 // Used for the "system" URLRequestContext. |
152 class SystemURLRequestContext : public net::URLRequestContext { | 152 class SystemURLRequestContext : public net::URLRequestContext { |
153 public: | 153 public: |
154 SystemURLRequestContext() { | 154 SystemURLRequestContext() { |
155 #if defined(USE_NSS) || defined(OS_IOS) | 155 #if defined(USE_NSS_CERTS) || defined(OS_IOS) |
156 net::SetURLRequestContextForNSSHttpIO(this); | 156 net::SetURLRequestContextForNSSHttpIO(this); |
157 #endif | 157 #endif |
158 } | 158 } |
159 | 159 |
160 private: | 160 private: |
161 ~SystemURLRequestContext() override { | 161 ~SystemURLRequestContext() override { |
162 AssertNoURLRequests(); | 162 AssertNoURLRequests(); |
163 #if defined(USE_NSS) || defined(OS_IOS) | 163 #if defined(USE_NSS_CERTS) || defined(OS_IOS) |
164 net::SetURLRequestContextForNSSHttpIO(NULL); | 164 net::SetURLRequestContextForNSSHttpIO(NULL); |
165 #endif | 165 #endif |
166 } | 166 } |
167 }; | 167 }; |
168 | 168 |
169 scoped_ptr<net::HostResolver> CreateGlobalHostResolver(net::NetLog* net_log) { | 169 scoped_ptr<net::HostResolver> CreateGlobalHostResolver(net::NetLog* net_log) { |
170 TRACE_EVENT0("startup", "IOThread::CreateGlobalHostResolver"); | 170 TRACE_EVENT0("startup", "IOThread::CreateGlobalHostResolver"); |
171 const base::CommandLine& command_line = | 171 const base::CommandLine& command_line = |
172 *base::CommandLine::ForCurrentProcess(); | 172 *base::CommandLine::ForCurrentProcess(); |
173 | 173 |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 } | 619 } |
620 | 620 |
621 void IOThread::InitAsync() { | 621 void IOThread::InitAsync() { |
622 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 622 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
623 // is fixed. | 623 // is fixed. |
624 tracked_objects::ScopedTracker tracking_profile1( | 624 tracked_objects::ScopedTracker tracking_profile1( |
625 FROM_HERE_WITH_EXPLICIT_FUNCTION("466432 IOThread::InitAsync::Start")); | 625 FROM_HERE_WITH_EXPLICIT_FUNCTION("466432 IOThread::InitAsync::Start")); |
626 TRACE_EVENT0("startup", "IOThread::InitAsync"); | 626 TRACE_EVENT0("startup", "IOThread::InitAsync"); |
627 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 627 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
628 | 628 |
629 #if defined(USE_NSS) || defined(OS_IOS) | 629 #if defined(USE_NSS_CERTS) || defined(OS_IOS) |
630 net::SetMessageLoopForNSSHttpIO(); | 630 net::SetMessageLoopForNSSHttpIO(); |
631 #endif | 631 #endif |
632 | 632 |
633 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 633 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
634 // is fixed. | 634 // is fixed. |
635 tracked_objects::ScopedTracker tracking_profile2( | 635 tracked_objects::ScopedTracker tracking_profile2( |
636 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 636 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
637 "466432 IOThread::InitAsync::CommandLineForCurrentProcess")); | 637 "466432 IOThread::InitAsync::CommandLineForCurrentProcess")); |
638 const base::CommandLine& command_line = | 638 const base::CommandLine& command_line = |
639 *base::CommandLine::ForCurrentProcess(); | 639 *base::CommandLine::ForCurrentProcess(); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 // thread until after IOThread is gone, so use a weak pointer. | 891 // thread until after IOThread is gone, so use a weak pointer. |
892 BrowserThread::PostTask(BrowserThread::UI, | 892 BrowserThread::PostTask(BrowserThread::UI, |
893 FROM_HERE, | 893 FROM_HERE, |
894 base::Bind(&IOThread::InitSystemRequestContext, | 894 base::Bind(&IOThread::InitSystemRequestContext, |
895 weak_factory_.GetWeakPtr())); | 895 weak_factory_.GetWeakPtr())); |
896 } | 896 } |
897 | 897 |
898 void IOThread::CleanUp() { | 898 void IOThread::CleanUp() { |
899 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks(); | 899 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks(); |
900 | 900 |
901 #if defined(USE_NSS) || defined(OS_IOS) | 901 #if defined(USE_NSS_CERTS) || defined(OS_IOS) |
902 net::ShutdownNSSHttpIO(); | 902 net::ShutdownNSSHttpIO(); |
903 #endif | 903 #endif |
904 | 904 |
905 system_url_request_context_getter_ = NULL; | 905 system_url_request_context_getter_ = NULL; |
906 | 906 |
907 // Release objects that the net::URLRequestContext could have been pointing | 907 // Release objects that the net::URLRequestContext could have been pointing |
908 // to. | 908 // to. |
909 | 909 |
910 // Shutdown the HistogramWatcher on the IO thread. | 910 // Shutdown the HistogramWatcher on the IO thread. |
911 net::NetworkChangeNotifier::ShutdownHistogramWatcher(); | 911 net::NetworkChangeNotifier::ShutdownHistogramWatcher(); |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1600 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
1601 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1601 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1602 net::QuicVersion version = supported_versions[i]; | 1602 net::QuicVersion version = supported_versions[i]; |
1603 if (net::QuicVersionToString(version) == quic_version) { | 1603 if (net::QuicVersionToString(version) == quic_version) { |
1604 return version; | 1604 return version; |
1605 } | 1605 } |
1606 } | 1606 } |
1607 | 1607 |
1608 return net::QUIC_VERSION_UNSUPPORTED; | 1608 return net::QUIC_VERSION_UNSUPPORTED; |
1609 } | 1609 } |
OLD | NEW |