| 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/dns_global.h" | 11 #include "chrome/browser/net/dns_global.h" |
| 12 #include "chrome/browser/net/url_fetcher.h" | 12 #include "chrome/browser/net/url_fetcher.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "net/base/fixed_host_resolver.h" | 14 #include "net/base/fixed_host_resolver.h" |
| 15 #include "net/base/host_cache.h" | 15 #include "net/base/host_cache.h" |
| 16 #include "net/base/host_resolver.h" | 16 #include "net/base/host_resolver.h" |
| 17 #include "net/base/host_resolver_impl.h" |
| 17 #include "net/url_request/url_request.h" | 18 #include "net/url_request/url_request.h" |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 net::HostResolver* CreateGlobalHostResolver() { | 22 net::HostResolver* CreateGlobalHostResolver() { |
| 22 net::HostResolver* global_host_resolver = NULL; | 23 net::HostResolver* global_host_resolver = NULL; |
| 23 | 24 |
| 24 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 25 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 25 | 26 |
| 26 // The FixedHostResolver allows us to send all network requests through | 27 // The FixedHostResolver allows us to send all network requests through |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 void IOThread::ChangedToOnTheRecordOnIOThread() { | 171 void IOThread::ChangedToOnTheRecordOnIOThread() { |
| 171 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 172 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); |
| 172 | 173 |
| 173 if (dns_master_) { | 174 if (dns_master_) { |
| 174 // Destroy all evidence of our OTR session. | 175 // Destroy all evidence of our OTR session. |
| 175 dns_master_->DnsMaster::DiscardAllResults(); | 176 dns_master_->DnsMaster::DiscardAllResults(); |
| 176 } | 177 } |
| 177 | 178 |
| 178 // Clear the host cache to avoid showing entries from the OTR session | 179 // Clear the host cache to avoid showing entries from the OTR session |
| 179 // in about:net-internals. | 180 // in about:net-internals. |
| 180 net::HostCache* host_cache = host_resolver_->GetHostCache(); | 181 if (host_resolver_->IsHostResolverImpl()) { |
| 181 if (host_cache) | 182 net::HostCache* host_cache = static_cast<net::HostResolverImpl*>( |
| 182 host_cache->clear(); | 183 host_resolver_)->cache(); |
| 184 if (host_cache) |
| 185 host_cache->clear(); |
| 186 } |
| 183 } | 187 } |
| OLD | NEW |