Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Unified Diff: net/log/net_log_util.cc

Issue 1908543002: DNS: Retain stale entries in HostCache and return when requested (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, make all members of Entry private Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/dns/mock_host_resolver.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/log/net_log_util.cc
diff --git a/net/log/net_log_util.cc b/net/log/net_log_util.cc
index 2b5f6b553b7cd1490d2f6ef2aeb1775348fffbc9..15933e491808199a3d99dd3df7d9cab8ec4c560d 100644
--- a/net/log/net_log_util.cc
+++ b/net/log/net_log_util.cc
@@ -381,10 +381,9 @@ NET_EXPORT std::unique_ptr<base::DictionaryValue> GetNetInfo(
base::ListValue* entry_list = new base::ListValue();
- HostCache::EntryMap::Iterator it(cache->entries());
- for (; it.HasNext(); it.Advance()) {
- const HostCache::Key& key = it.key();
- const HostCache::Entry& entry = it.value();
+ for (const auto& pair : cache->entries()) {
+ const HostCache::Key& key = pair.first;
+ const HostCache::Entry& entry = pair.second;
base::DictionaryValue* entry_dict = new base::DictionaryValue();
@@ -392,16 +391,16 @@ NET_EXPORT std::unique_ptr<base::DictionaryValue> GetNetInfo(
entry_dict->SetInteger("address_family",
static_cast<int>(key.address_family));
entry_dict->SetString("expiration",
- NetLog::TickCountToString(it.expiration()));
+ NetLog::TickCountToString(entry.expires()));
- if (entry.error != OK) {
- entry_dict->SetInteger("error", entry.error);
+ if (entry.error() != OK) {
+ entry_dict->SetInteger("error", entry.error());
} else {
+ const AddressList& addresses = entry.addresses();
// Append all of the resolved addresses.
base::ListValue* address_list = new base::ListValue();
- for (size_t i = 0; i < entry.addrlist.size(); ++i) {
- address_list->AppendString(entry.addrlist[i].ToStringWithoutPort());
- }
+ for (size_t i = 0; i < addresses.size(); ++i)
+ address_list->AppendString(addresses[i].ToStringWithoutPort());
entry_dict->Set("addresses", address_list);
}
« no previous file with comments | « net/dns/mock_host_resolver.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698