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

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: make requested changes, and some others, and rebase Created 4 years, 8 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
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..2234f357443485e4c33066245889147589dc5900 100644
--- a/net/log/net_log_util.cc
+++ b/net/log/net_log_util.cc
@@ -375,41 +375,11 @@ NET_EXPORT std::unique_ptr<base::DictionaryValue> GetNetInfo(
dict->Set("dns_config", std::move(dns_config));
base::DictionaryValue* cache_info_dict = new base::DictionaryValue();
-
cache_info_dict->SetInteger("capacity",
static_cast<int>(cache->max_entries()));
-
- 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();
-
- base::DictionaryValue* entry_dict = new base::DictionaryValue();
-
- entry_dict->SetString("hostname", key.hostname);
- entry_dict->SetInteger("address_family",
- static_cast<int>(key.address_family));
- entry_dict->SetString("expiration",
- NetLog::TickCountToString(it.expiration()));
-
- if (entry.error != OK) {
- entry_dict->SetInteger("error", entry.error);
- } else {
- // 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());
- }
- entry_dict->Set("addresses", address_list);
- }
-
- entry_list->Append(entry_dict);
- }
-
- cache_info_dict->Set("entries", entry_list);
+ cache_info_dict->Set("entries", cache->GetEntriesAsValue());
dict->Set("cache", cache_info_dict);
+
net_info_dict->Set(NetInfoSourceToString(NET_INFO_HOST_RESOLVER),
std::move(dict));
}

Powered by Google App Engine
This is Rietveld 408576698