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

Unified Diff: base/values.h

Issue 2740143002: Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Comment Updates Created 3 years, 9 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: base/values.h
diff --git a/base/values.h b/base/values.h
index d4b334c2a57d14ee7cc35e13b3919bc4e5072c63..0d2ac8afe88ff022f822d4831dd186ff2d1e72cc 100644
--- a/base/values.h
+++ b/base/values.h
@@ -49,7 +49,7 @@ using BinaryValue = Value;
class BASE_EXPORT Value {
public:
using DictStorage = std::map<std::string, std::unique_ptr<Value>>;
- using ListStorage = std::vector<std::unique_ptr<Value>>;
+ using ListStorage = std::vector<Value>;
enum class Type {
NONE = 0,
@@ -97,6 +97,9 @@ class BASE_EXPORT Value {
explicit Value(const std::vector<char>& in_blob);
explicit Value(std::vector<char>&& in_blob);
+ explicit Value(const ListStorage& in_list);
Devlin 2017/03/15 15:25:03 Not my area, so no need to wait for my signoff, bu
jdoerrie 2017/03/16 19:01:56 Currently this is only used within |Value::DeepCop
+ explicit Value(ListStorage&& in_list);
+
Value& operator=(const Value& that);
Value& operator=(Value&& that);
@@ -377,9 +380,15 @@ class BASE_EXPORT ListValue : public Value {
// Returns the number of Values in this list.
size_t GetSize() const { return list_->size(); }
+ // Returns the capacity of storage for Values in this list.
+ size_t capacity() const { return list_->capacity(); }
+
// Returns whether the list is empty.
bool empty() const { return list_->empty(); }
+ // Reserves storage for at least |n| values.
+ void Reserve(size_t n);
jdoerrie 2017/03/15 10:10:41 I tried to minimize API changes, but these were st
+
// Sets the list item at the given index to be the Value specified by
// the value given. If the index beyond the current end of the list, null
// Values will be used to pad out the list.
« no previous file with comments | « base/trace_event/trace_event_memory_overhead.cc ('k') | base/values.cc » ('j') | base/values.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698