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

Unified Diff: net/dns/host_cache.cc

Issue 2938183003: Make HostCache::RestoreFromListValue() take a const reference (Closed)
Patch Set: auto Created 3 years, 6 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/host_cache.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/host_cache.cc
diff --git a/net/dns/host_cache.cc b/net/dns/host_cache.cc
index 84a6e80c6f38072d18d33fd8dd71492389d591d3..999d3f6b221876080b33966ced906c5af1c0d9c3 100644
--- a/net/dns/host_cache.cc
+++ b/net/dns/host_cache.cc
@@ -41,7 +41,7 @@ const char kNetworkChangesKey[] = "network_changes";
const char kErrorKey[] = "error";
const char kAddressesKey[] = "addresses";
-bool AddressListFromListValue(base::ListValue* value, AddressList* list) {
+bool AddressListFromListValue(const base::ListValue* value, AddressList* list) {
list->clear();
for (base::ListValue::const_iterator it = value->begin(); it != value->end();
it++) {
@@ -315,10 +315,9 @@ std::unique_ptr<base::ListValue> HostCache::GetAsListValue(
}
// TODO(mgersh): Add histograms to track failures.
-bool HostCache::RestoreFromListValue(base::ListValue& old_cache) {
- for (base::ListValue::iterator it = old_cache.begin(); it != old_cache.end();
- it++) {
- base::DictionaryValue* entry_dict;
+bool HostCache::RestoreFromListValue(const base::ListValue& old_cache) {
+ for (auto it = old_cache.begin(); it != old_cache.end(); it++) {
+ const base::DictionaryValue* entry_dict;
if (!it->GetAsDictionary(&entry_dict))
return false;
@@ -328,7 +327,7 @@ bool HostCache::RestoreFromListValue(base::ListValue& old_cache) {
int error = OK;
std::string expiration;
base::ListValue empty_list;
- base::ListValue* addresses_value = &empty_list;
+ const base::ListValue* addresses_value = &empty_list;
AddressList address_list;
if (!entry_dict->GetString(kHostnameKey, &hostname) ||
« no previous file with comments | « net/dns/host_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698