| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/leak_tracker.h" | 10 #include "base/debug/leak_tracker.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 return global_host_resolver; | 145 return global_host_resolver; |
| 146 | 146 |
| 147 net::MappedHostResolver* remapped_resolver = | 147 net::MappedHostResolver* remapped_resolver = |
| 148 new net::MappedHostResolver(global_host_resolver); | 148 new net::MappedHostResolver(global_host_resolver); |
| 149 remapped_resolver->SetRulesFromString( | 149 remapped_resolver->SetRulesFromString( |
| 150 command_line.GetSwitchValueASCII(switches::kHostResolverRules)); | 150 command_line.GetSwitchValueASCII(switches::kHostResolverRules)); |
| 151 return remapped_resolver; | 151 return remapped_resolver; |
| 152 } | 152 } |
| 153 | 153 |
| 154 class LoggingNetworkChangeObserver | 154 class LoggingNetworkChangeObserver |
| 155 : public net::NetworkChangeNotifier::Observer { | 155 : public net::NetworkChangeNotifier::IPAddressObserver { |
| 156 public: | 156 public: |
| 157 // |net_log| must remain valid throughout our lifetime. | 157 // |net_log| must remain valid throughout our lifetime. |
| 158 explicit LoggingNetworkChangeObserver(net::NetLog* net_log) | 158 explicit LoggingNetworkChangeObserver(net::NetLog* net_log) |
| 159 : net_log_(net_log) { | 159 : net_log_(net_log) { |
| 160 net::NetworkChangeNotifier::AddObserver(this); | 160 net::NetworkChangeNotifier::AddIPAddressObserver(this); |
| 161 } | 161 } |
| 162 | 162 |
| 163 ~LoggingNetworkChangeObserver() { | 163 ~LoggingNetworkChangeObserver() { |
| 164 net::NetworkChangeNotifier::RemoveObserver(this); | 164 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); |
| 165 } | 165 } |
| 166 | 166 |
| 167 virtual void OnIPAddressChanged() { | 167 virtual void OnIPAddressChanged() { |
| 168 VLOG(1) << "Observed a change to the network IP addresses"; | 168 VLOG(1) << "Observed a change to the network IP addresses"; |
| 169 | 169 |
| 170 net_log_->AddEntry(net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED, | 170 net_log_->AddEntry(net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED, |
| 171 base::TimeTicks::Now(), | 171 base::TimeTicks::Now(), |
| 172 net::NetLog::Source(), | 172 net::NetLog::Source(), |
| 173 net::NetLog::PHASE_NONE, | 173 net::NetLog::PHASE_NONE, |
| 174 NULL); | 174 NULL); |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 void IOThread::ClearHostCache() { | 542 void IOThread::ClearHostCache() { |
| 543 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 543 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 544 | 544 |
| 545 if (globals_->host_resolver->GetAsHostResolverImpl()) { | 545 if (globals_->host_resolver->GetAsHostResolverImpl()) { |
| 546 net::HostCache* host_cache = | 546 net::HostCache* host_cache = |
| 547 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); | 547 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); |
| 548 if (host_cache) | 548 if (host_cache) |
| 549 host_cache->clear(); | 549 host_cache->clear(); |
| 550 } | 550 } |
| 551 } | 551 } |
| OLD | NEW |