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

Unified Diff: net/base/sdch_manager.cc

Issue 1152103003: Returning scoped_ptr in SdchInfoToValue() instead of raw pointers in net/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/base/sdch_manager.h ('k') | net/log/net_log_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/sdch_manager.cc
diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc
index dbfdf5de31ee46099669d61f09c50ff53270592c..85388a2cccb715a522bd238cf0a5c51e2f49d0cf 100644
--- a/net/base/sdch_manager.cc
+++ b/net/base/sdch_manager.cc
@@ -489,46 +489,46 @@ void SdchManager::UrlSafeBase64Encode(const std::string& input,
std::replace(output->begin(), output->end(), '/', '_');
}
-base::Value* SdchManager::SdchInfoToValue() const {
- base::DictionaryValue* value = new base::DictionaryValue();
+scoped_ptr<base::Value> SdchManager::SdchInfoToValue() const {
+ scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
value->SetBoolean("sdch_enabled", sdch_enabled());
value->SetBoolean("secure_scheme_support", secure_scheme_supported());
- base::ListValue* entry_list = new base::ListValue();
+ scoped_ptr<base::ListValue> entry_list(new base::ListValue());
for (const auto& entry: dictionaries_) {
- base::DictionaryValue* entry_dict = new base::DictionaryValue();
+ scoped_ptr<base::DictionaryValue> entry_dict(new base::DictionaryValue());
entry_dict->SetString("url", entry.second->data.url().spec());
entry_dict->SetString("client_hash", entry.second->data.client_hash());
entry_dict->SetString("domain", entry.second->data.domain());
entry_dict->SetString("path", entry.second->data.path());
- base::ListValue* port_list = new base::ListValue();
+ scoped_ptr<base::ListValue> port_list(new base::ListValue());
for (std::set<int>::const_iterator port_it =
entry.second->data.ports().begin();
port_it != entry.second->data.ports().end(); ++port_it) {
port_list->AppendInteger(*port_it);
}
- entry_dict->Set("ports", port_list);
+ entry_dict->Set("ports", port_list.Pass());
entry_dict->SetString("server_hash", entry.first);
- entry_list->Append(entry_dict);
+ entry_list->Append(entry_dict.Pass());
}
- value->Set("dictionaries", entry_list);
+ value->Set("dictionaries", entry_list.Pass());
- entry_list = new base::ListValue();
+ entry_list.reset();
eroman 2015/05/26 18:19:58 Not correct. Also this was already done in https:/
for (DomainBlacklistInfo::const_iterator it = blacklisted_domains_.begin();
it != blacklisted_domains_.end(); ++it) {
if (it->second.count == 0)
continue;
- base::DictionaryValue* entry_dict = new base::DictionaryValue();
+ scoped_ptr<base::DictionaryValue> entry_dict(new base::DictionaryValue());
entry_dict->SetString("domain", it->first);
if (it->second.count != INT_MAX)
entry_dict->SetInteger("tries", it->second.count);
entry_dict->SetInteger("reason", it->second.reason);
- entry_list->Append(entry_dict);
+ entry_list->Append(entry_dict.Pass());
}
- value->Set("blacklisted", entry_list);
+ value->Set("blacklisted", entry_list.Pass());
- return value;
+ return value.Pass();
}
} // namespace net
« no previous file with comments | « net/base/sdch_manager.h ('k') | net/log/net_log_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698