| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/leak_tracker.h" | 8 #include "base/leak_tracker.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| 11 #include "base/string_split.h" | 11 #include "base/string_split.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/chrome_thread.h" | 14 #include "chrome/browser/chrome_thread.h" |
| 15 #include "chrome/browser/gpu_process_host.h" | 15 #include "chrome/browser/gpu_process_host.h" |
| 16 #include "chrome/browser/net/chrome_net_log.h" | 16 #include "chrome/browser/net/chrome_net_log.h" |
| 17 #include "chrome/browser/net/predictor_api.h" | 17 #include "chrome/browser/net/predictor_api.h" |
| 18 #include "chrome/browser/net/passive_log_collector.h" | 18 #include "chrome/browser/net/passive_log_collector.h" |
| 19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/common/net/url_fetcher.h" | 20 #include "chrome/common/net/url_fetcher.h" |
| 21 #include "net/base/dnsrr_resolver.h" | 21 #include "net/base/dnsrr_resolver.h" |
| 22 #include "net/base/mapped_host_resolver.h" | 22 #include "net/base/mapped_host_resolver.h" |
| 23 #include "net/base/host_cache.h" | 23 #include "net/base/host_cache.h" |
| 24 #include "net/base/host_resolver.h" | 24 #include "net/base/host_resolver.h" |
| 25 #include "net/base/host_resolver_impl.h" | 25 #include "net/base/host_resolver_impl.h" |
| 26 #include "net/base/net_util.h" | 26 #include "net/base/net_util.h" |
| 27 #include "net/http/http_auth_filter.h" | 27 #include "net/http/http_auth_filter.h" |
| 28 #include "net/http/http_auth_handler_factory.h" | 28 #include "net/http/http_auth_handler_factory.h" |
| 29 #if defined(USE_NSS) |
| 30 #include "net/ocsp/nss_ocsp.h" |
| 31 #endif // defined(USE_NSS) |
| 29 #include "net/proxy/proxy_script_fetcher.h" | 32 #include "net/proxy/proxy_script_fetcher.h" |
| 30 | 33 |
| 31 namespace { | 34 namespace { |
| 32 | 35 |
| 33 net::HostResolver* CreateGlobalHostResolver(net::NetLog* net_log) { | 36 net::HostResolver* CreateGlobalHostResolver(net::NetLog* net_log) { |
| 34 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 37 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 35 | 38 |
| 36 size_t parallelism = net::HostResolver::kDefaultParallelism; | 39 size_t parallelism = net::HostResolver::kDefaultParallelism; |
| 37 | 40 |
| 38 // Use the concurrency override from the command-line, if any. | 41 // Use the concurrency override from the command-line, if any. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 message_loop()->PostTask( | 156 message_loop()->PostTask( |
| 154 FROM_HERE, | 157 FROM_HERE, |
| 155 NewRunnableMethod( | 158 NewRunnableMethod( |
| 156 this, | 159 this, |
| 157 &IOThread::ChangedToOnTheRecordOnIOThread)); | 160 &IOThread::ChangedToOnTheRecordOnIOThread)); |
| 158 } | 161 } |
| 159 | 162 |
| 160 void IOThread::Init() { | 163 void IOThread::Init() { |
| 161 BrowserProcessSubThread::Init(); | 164 BrowserProcessSubThread::Init(); |
| 162 | 165 |
| 166 DCHECK_EQ(MessageLoop::TYPE_IO, message_loop()->type()); |
| 167 |
| 168 #if defined(USE_NSS) |
| 169 net::SetMessageLoopForOCSP(); |
| 170 #endif // defined(USE_NSS) |
| 171 |
| 163 DCHECK(!globals_); | 172 DCHECK(!globals_); |
| 164 globals_ = new Globals; | 173 globals_ = new Globals; |
| 165 | 174 |
| 166 globals_->net_log.reset(new ChromeNetLog()); | 175 globals_->net_log.reset(new ChromeNetLog()); |
| 167 | 176 |
| 168 // Add an observer that will emit network change events to the ChromeNetLog. | 177 // Add an observer that will emit network change events to the ChromeNetLog. |
| 169 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be | 178 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be |
| 170 // logging the network change before other IO thread consumers respond to it. | 179 // logging the network change before other IO thread consumers respond to it. |
| 171 network_change_observer_.reset( | 180 network_change_observer_.reset( |
| 172 new LoggingNetworkChangeObserver(globals_->net_log.get())); | 181 new LoggingNetworkChangeObserver(globals_->net_log.get())); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 net::HostCache* host_cache = | 321 net::HostCache* host_cache = |
| 313 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); | 322 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); |
| 314 if (host_cache) | 323 if (host_cache) |
| 315 host_cache->clear(); | 324 host_cache->clear(); |
| 316 } | 325 } |
| 317 // Clear all of the passively logged data. | 326 // Clear all of the passively logged data. |
| 318 // TODO(eroman): this is a bit heavy handed, really all we need to do is | 327 // TODO(eroman): this is a bit heavy handed, really all we need to do is |
| 319 // clear the data pertaining to off the record context. | 328 // clear the data pertaining to off the record context. |
| 320 globals_->net_log->passive_collector()->Clear(); | 329 globals_->net_log->passive_collector()->Clear(); |
| 321 } | 330 } |
| OLD | NEW |