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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 } | 620 } |
621 | 621 |
622 void IOThread::InitAsync() { | 622 void IOThread::InitAsync() { |
623 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 623 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
624 // is fixed. | 624 // is fixed. |
625 tracked_objects::ScopedTracker tracking_profile1( | 625 tracked_objects::ScopedTracker tracking_profile1( |
626 FROM_HERE_WITH_EXPLICIT_FUNCTION("466432 IOThread::InitAsync::Start")); | 626 FROM_HERE_WITH_EXPLICIT_FUNCTION("466432 IOThread::InitAsync::Start")); |
627 TRACE_EVENT0("startup", "IOThread::InitAsync"); | 627 TRACE_EVENT0("startup", "IOThread::InitAsync"); |
628 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 628 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
629 | 629 |
630 #if defined(USE_NSS) || defined(OS_IOS) | 630 #if defined(USE_NSS_CERTS) || defined(OS_IOS) |
631 net::SetMessageLoopForNSSHttpIO(); | 631 net::SetMessageLoopForNSSHttpIO(); |
632 #endif | 632 #endif |
633 | 633 |
634 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 634 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
635 // is fixed. | 635 // is fixed. |
636 tracked_objects::ScopedTracker tracking_profile2( | 636 tracked_objects::ScopedTracker tracking_profile2( |
637 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 637 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
638 "466432 IOThread::InitAsync::CommandLineForCurrentProcess")); | 638 "466432 IOThread::InitAsync::CommandLineForCurrentProcess")); |
639 const base::CommandLine& command_line = | 639 const base::CommandLine& command_line = |
640 *base::CommandLine::ForCurrentProcess(); | 640 *base::CommandLine::ForCurrentProcess(); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 // thread until after IOThread is gone, so use a weak pointer. | 892 // thread until after IOThread is gone, so use a weak pointer. |
893 BrowserThread::PostTask(BrowserThread::UI, | 893 BrowserThread::PostTask(BrowserThread::UI, |
894 FROM_HERE, | 894 FROM_HERE, |
895 base::Bind(&IOThread::InitSystemRequestContext, | 895 base::Bind(&IOThread::InitSystemRequestContext, |
896 weak_factory_.GetWeakPtr())); | 896 weak_factory_.GetWeakPtr())); |
897 } | 897 } |
898 | 898 |
899 void IOThread::CleanUp() { | 899 void IOThread::CleanUp() { |
900 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks(); | 900 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks(); |
901 | 901 |
902 #if defined(USE_NSS) || defined(OS_IOS) | 902 #if defined(USE_NSS_CERTS) || defined(OS_IOS) |
903 net::ShutdownNSSHttpIO(); | 903 net::ShutdownNSSHttpIO(); |
904 #endif | 904 #endif |
905 | 905 |
906 system_url_request_context_getter_ = NULL; | 906 system_url_request_context_getter_ = NULL; |
907 | 907 |
908 // Release objects that the net::URLRequestContext could have been pointing | 908 // Release objects that the net::URLRequestContext could have been pointing |
909 // to. | 909 // to. |
910 | 910 |
911 // Shutdown the HistogramWatcher on the IO thread. | 911 // Shutdown the HistogramWatcher on the IO thread. |
912 net::NetworkChangeNotifier::ShutdownHistogramWatcher(); | 912 net::NetworkChangeNotifier::ShutdownHistogramWatcher(); |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1601 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
1602 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1602 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1603 net::QuicVersion version = supported_versions[i]; | 1603 net::QuicVersion version = supported_versions[i]; |
1604 if (net::QuicVersionToString(version) == quic_version) { | 1604 if (net::QuicVersionToString(version) == quic_version) { |
1605 return version; | 1605 return version; |
1606 } | 1606 } |
1607 } | 1607 } |
1608 | 1608 |
1609 return net::QUIC_VERSION_UNSUPPORTED; | 1609 return net::QUIC_VERSION_UNSUPPORTED; |
1610 } | 1610 } |
OLD | NEW |