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

Unified Diff: base/trace_event/trace_event_argument.cc

Issue 2740143002: Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Rebase Created 3 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
« no previous file with comments | « base/test/gtest_util.cc ('k') | base/trace_event/trace_event_memory_overhead.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_event_argument.cc
diff --git a/base/trace_event/trace_event_argument.cc b/base/trace_event/trace_event_argument.cc
index db702b6231e5249c9526d27ac439450c732e39a6..646b1f2168794fca6ec2108b085b1014a2205830 100644
--- a/base/trace_event/trace_event_argument.cc
+++ b/base/trace_event/trace_event_argument.cc
@@ -289,7 +289,7 @@ void TracedValue::SetBaseValueWithCopiedName(base::StringPiece name,
value.GetAsList(&list_value);
BeginArrayWithCopiedName(name);
for (const auto& base_value : *list_value)
- AppendBaseValue(*base_value);
+ AppendBaseValue(base_value);
EndArray();
} break;
}
@@ -343,7 +343,7 @@ void TracedValue::AppendBaseValue(const base::Value& value) {
value.GetAsList(&list_value);
BeginArray();
for (const auto& base_value : *list_value)
- AppendBaseValue(*base_value);
+ AppendBaseValue(base_value);
EndArray();
} break;
}
@@ -369,9 +369,11 @@ std::unique_ptr<base::Value> TracedValue::ToBaseValue() const {
cur_dict = new_dict;
} else {
cur_list->Append(WrapUnique(new_dict));
+ // |new_dict| is invalidated at this point, so |cur_dict| needs to be
+ // reset.
+ cur_list->GetDictionary(cur_list->GetSize() - 1, &cur_dict);
stack.push_back(cur_list);
cur_list = nullptr;
- cur_dict = new_dict;
}
} break;
@@ -396,7 +398,8 @@ std::unique_ptr<base::Value> TracedValue::ToBaseValue() const {
} else {
cur_list->Append(WrapUnique(new_list));
stack.push_back(cur_list);
- cur_list = new_list;
+ // |cur_list| is invalidated at this point, so it needs to be reset.
+ cur_list->GetList(cur_list->GetSize() - 1, &cur_list);
}
} break;
« no previous file with comments | « base/test/gtest_util.cc ('k') | base/trace_event/trace_event_memory_overhead.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698