| 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 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/leak_tracker.h" | 7 #include "base/leak_tracker.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| 11 #include "chrome/browser/net/chrome_net_log.h" |
| 11 #include "chrome/browser/net/dns_global.h" | 12 #include "chrome/browser/net/dns_global.h" |
| 13 #include "chrome/browser/net/passive_log_collector.h" |
| 12 #include "chrome/browser/net/url_fetcher.h" | 14 #include "chrome/browser/net/url_fetcher.h" |
| 13 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 14 #include "net/base/mapped_host_resolver.h" | 16 #include "net/base/mapped_host_resolver.h" |
| 15 #include "net/base/host_cache.h" | 17 #include "net/base/host_cache.h" |
| 16 #include "net/base/host_resolver.h" | 18 #include "net/base/host_resolver.h" |
| 17 #include "net/base/host_resolver_impl.h" | 19 #include "net/base/host_resolver_impl.h" |
| 18 #include "net/base/net_util.h" | 20 #include "net/base/net_util.h" |
| 19 #include "net/base/network_change_notifier.h" | 21 #include "net/base/network_change_notifier.h" |
| 20 #include "net/http/http_auth_filter.h" | 22 #include "net/http/http_auth_filter.h" |
| 21 #include "net/http/http_auth_handler_factory.h" | 23 #include "net/http/http_auth_handler_factory.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 this, | 119 this, |
| 118 &IOThread::ChangedToOnTheRecordOnIOThread)); | 120 &IOThread::ChangedToOnTheRecordOnIOThread)); |
| 119 } | 121 } |
| 120 | 122 |
| 121 void IOThread::Init() { | 123 void IOThread::Init() { |
| 122 BrowserProcessSubThread::Init(); | 124 BrowserProcessSubThread::Init(); |
| 123 | 125 |
| 124 DCHECK(!globals_); | 126 DCHECK(!globals_); |
| 125 globals_ = new Globals; | 127 globals_ = new Globals; |
| 126 | 128 |
| 129 globals_->net_log.reset(new ChromeNetLog()); |
| 127 globals_->network_change_notifier.reset( | 130 globals_->network_change_notifier.reset( |
| 128 net::NetworkChangeNotifier::CreateDefaultNetworkChangeNotifier()); | 131 net::NetworkChangeNotifier::CreateDefaultNetworkChangeNotifier()); |
| 129 globals_->host_resolver = | 132 globals_->host_resolver = |
| 130 CreateGlobalHostResolver(globals_->network_change_notifier.get()); | 133 CreateGlobalHostResolver(globals_->network_change_notifier.get()); |
| 131 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory()); | 134 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory()); |
| 132 } | 135 } |
| 133 | 136 |
| 134 void IOThread::CleanUp() { | 137 void IOThread::CleanUp() { |
| 135 // Not initialized in Init(). May not be initialized. | 138 // Not initialized in Init(). May not be initialized. |
| 136 if (dns_master_) { | 139 if (dns_master_) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 } | 237 } |
| 235 | 238 |
| 236 // Clear the host cache to avoid showing entries from the OTR session | 239 // Clear the host cache to avoid showing entries from the OTR session |
| 237 // in about:net-internals. | 240 // in about:net-internals. |
| 238 if (globals_->host_resolver->GetAsHostResolverImpl()) { | 241 if (globals_->host_resolver->GetAsHostResolverImpl()) { |
| 239 net::HostCache* host_cache = | 242 net::HostCache* host_cache = |
| 240 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); | 243 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); |
| 241 if (host_cache) | 244 if (host_cache) |
| 242 host_cache->clear(); | 245 host_cache->clear(); |
| 243 } | 246 } |
| 247 // Clear all of the passively logged data. |
| 248 // TODO(eroman): this is a bit heavy handed, really all we need to do is |
| 249 // clear the data pertaining to off the record context. |
| 250 globals_->net_log->passive_collector()->Clear(); |
| 244 } | 251 } |
| OLD | NEW |