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

Unified Diff: net/log/test_net_log.cc

Issue 1549483004: Make ParametersToValue return scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Created 5 years 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/log/net_log.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/log/test_net_log.cc
diff --git a/net/log/test_net_log.cc b/net/log/test_net_log.cc
index 0e82ae1eaf0f0ea1807fdf98d619a7d91ba0c015..c8d04cb71f1c9ee6a76964a13e8bd94644db728e 100644
--- a/net/log/test_net_log.cc
+++ b/net/log/test_net_log.cc
@@ -50,16 +50,14 @@ class TestNetLog::Observer : public NetLog::ThreadSafeObserver {
void OnAddEntry(const NetLog::Entry& entry) override {
// Using Dictionaries instead of Values makes checking values a little
// simpler.
- base::DictionaryValue* param_dict = nullptr;
- base::Value* param_value = entry.ParametersToValue();
- if (param_value && !param_value->GetAsDictionary(&param_dict))
- delete param_value;
+ scoped_ptr<base::DictionaryValue> param_dict =
+ base::DictionaryValue::From(entry.ParametersToValue());
// Only need to acquire the lock when accessing class variables.
base::AutoLock lock(lock_);
- entry_list_.push_back(TestNetLogEntry(
- entry.type(), base::TimeTicks::Now(), entry.source(), entry.phase(),
- scoped_ptr<base::DictionaryValue>(param_dict)));
+ entry_list_.push_back(TestNetLogEntry(entry.type(), base::TimeTicks::Now(),
+ entry.source(), entry.phase(),
+ std::move(param_dict)));
}
// Needs to be "mutable" to use it in GetEntries().
« no previous file with comments | « net/log/net_log.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698