| 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/mapped_host_resolver.h" | 22 #include "net/base/mapped_host_resolver.h" |
| 22 #include "net/base/host_cache.h" | 23 #include "net/base/host_cache.h" |
| 23 #include "net/base/host_resolver.h" | 24 #include "net/base/host_resolver.h" |
| 24 #include "net/base/host_resolver_impl.h" | 25 #include "net/base/host_resolver_impl.h" |
| 25 #include "net/base/net_util.h" | 26 #include "net/base/net_util.h" |
| 26 #include "net/http/http_auth_filter.h" | 27 #include "net/http/http_auth_filter.h" |
| 27 #include "net/http/http_auth_handler_factory.h" | 28 #include "net/http/http_auth_handler_factory.h" |
| 28 | 29 |
| 29 namespace { | 30 namespace { |
| 30 | 31 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 globals_->net_log.reset(new ChromeNetLog()); | 165 globals_->net_log.reset(new ChromeNetLog()); |
| 165 | 166 |
| 166 // Add an observer that will emit network change events to the ChromeNetLog. | 167 // Add an observer that will emit network change events to the ChromeNetLog. |
| 167 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be | 168 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be |
| 168 // logging the network change before other IO thread consumers respond to it. | 169 // logging the network change before other IO thread consumers respond to it. |
| 169 network_change_observer_.reset( | 170 network_change_observer_.reset( |
| 170 new LoggingNetworkChangeObserver(globals_->net_log.get())); | 171 new LoggingNetworkChangeObserver(globals_->net_log.get())); |
| 171 | 172 |
| 172 globals_->host_resolver.reset( | 173 globals_->host_resolver.reset( |
| 173 CreateGlobalHostResolver(globals_->net_log.get())); | 174 CreateGlobalHostResolver(globals_->net_log.get())); |
| 175 globals_->dnsrr_resolver.reset(new net::DnsRRResolver); |
| 174 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( | 176 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( |
| 175 globals_->host_resolver.get())); | 177 globals_->host_resolver.get())); |
| 176 } | 178 } |
| 177 | 179 |
| 178 void IOThread::CleanUp() { | 180 void IOThread::CleanUp() { |
| 179 // This must be reset before the ChromeNetLog is destroyed. | 181 // This must be reset before the ChromeNetLog is destroyed. |
| 180 network_change_observer_.reset(); | 182 network_change_observer_.reset(); |
| 181 | 183 |
| 182 // If any child processes are still running, terminate them and | 184 // If any child processes are still running, terminate them and |
| 183 // and delete the BrowserChildProcessHost instances to release whatever | 185 // and delete the BrowserChildProcessHost instances to release whatever |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 net::HostCache* host_cache = | 309 net::HostCache* host_cache = |
| 308 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); | 310 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); |
| 309 if (host_cache) | 311 if (host_cache) |
| 310 host_cache->clear(); | 312 host_cache->clear(); |
| 311 } | 313 } |
| 312 // Clear all of the passively logged data. | 314 // Clear all of the passively logged data. |
| 313 // TODO(eroman): this is a bit heavy handed, really all we need to do is | 315 // TODO(eroman): this is a bit heavy handed, really all we need to do is |
| 314 // clear the data pertaining to off the record context. | 316 // clear the data pertaining to off the record context. |
| 315 globals_->net_log->passive_collector()->Clear(); | 317 globals_->net_log->passive_collector()->Clear(); |
| 316 } | 318 } |
| OLD | NEW |