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

Unified Diff: base/values.h

Issue 2809023003: Reland of Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: 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/trace_event/trace_event_memory_overhead.cc ('k') | base/values.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/values.h
diff --git a/base/values.h b/base/values.h
index ace8b43651a81677233d07a10a2e44f7a07b930b..075bc9fbb8fed7cd14095f1de4daa8a3ab9c13ea 100644
--- a/base/values.h
+++ b/base/values.h
@@ -49,7 +49,7 @@ class Value;
class BASE_EXPORT Value {
public:
using DictStorage = base::flat_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,
@@ -390,9 +390,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);
+
// 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698