diff options
Diffstat (limited to 'third_party/chromium/base/values.h')
-rw-r--r-- | third_party/chromium/base/values.h | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/third_party/chromium/base/values.h b/third_party/chromium/base/values.h index 36e24cc..fca5239 100644 --- a/third_party/chromium/base/values.h +++ b/third_party/chromium/base/values.h @@ -22,6 +22,7 @@ #include <iosfwd> #include <map> +#include <memory> #include <string> #include <utility> #include <vector> @@ -29,7 +30,6 @@ #include "base/base_export.h" #include "base/compiler_specific.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string_piece.h" namespace base { @@ -65,7 +65,7 @@ class BASE_EXPORT Value { virtual ~Value(); - static scoped_ptr<Value> CreateNullValue(); + static std::unique_ptr<Value> CreateNullValue(); // Returns the type of the value stored by the current Value object. // Each type will be implemented by only one subclass of Value, so it's @@ -100,7 +100,7 @@ class BASE_EXPORT Value { // this works because C++ supports covariant return types. virtual Value* DeepCopy() const; // Preferred version of DeepCopy. TODO(estade): remove the above. - scoped_ptr<Value> CreateDeepCopy() const; + std::unique_ptr<Value> CreateDeepCopy() const; // Compares if two Value objects have equal contents. virtual bool Equals(const Value* other) const; @@ -172,7 +172,7 @@ class BASE_EXPORT BinaryValue : public Value { // Creates a BinaryValue, taking ownership of the bytes pointed to by // |buffer|. - BinaryValue(scoped_ptr<char[]> buffer, size_t size); + BinaryValue(std::unique_ptr<char[]> buffer, size_t size); ~BinaryValue() override; @@ -193,7 +193,7 @@ class BASE_EXPORT BinaryValue : public Value { bool Equals(const Value* other) const override; private: - scoped_ptr<char[]> buffer_; + std::unique_ptr<char[]> buffer_; size_t size_; DISALLOW_COPY_AND_ASSIGN(BinaryValue); @@ -205,7 +205,7 @@ class BASE_EXPORT BinaryValue : public Value { class BASE_EXPORT DictionaryValue : public Value { public: // Returns |value| if it is a dictionary, nullptr otherwise. - static scoped_ptr<DictionaryValue> From(scoped_ptr<Value> value); + static std::unique_ptr<DictionaryValue> From(std::unique_ptr<Value> value); DictionaryValue(); ~DictionaryValue() override; @@ -233,7 +233,7 @@ class BASE_EXPORT DictionaryValue : public Value { // If the key at any step of the way doesn't exist, or exists but isn't // a DictionaryValue, a new DictionaryValue will be created and attached // to the path in that location. |in_value| must be non-null. - void Set(const std::string& path, scoped_ptr<Value> in_value); + void Set(const std::string& path, std::unique_ptr<Value> in_value); // Deprecated version of the above. TODO(estade): remove. void Set(const std::string& path, Value* in_value); @@ -247,7 +247,7 @@ class BASE_EXPORT DictionaryValue : public Value { // Like Set(), but without special treatment of '.'. This allows e.g. URLs to // be used as paths. void SetWithoutPathExpansion(const std::string& key, - scoped_ptr<Value> in_value); + std::unique_ptr<Value> in_value); // Deprecated version of the above. TODO(estade): remove. void SetWithoutPathExpansion(const std::string& key, Value* in_value); @@ -317,21 +317,22 @@ class BASE_EXPORT DictionaryValue : public Value { // |out_value|. If |out_value| is NULL, the removed value will be deleted. // This method returns true if |path| is a valid path; otherwise it will // return false and the DictionaryValue object will be unchanged. - virtual bool Remove(const std::string& path, scoped_ptr<Value>* out_value); + virtual bool Remove(const std::string& path, + std::unique_ptr<Value>* out_value); // Like Remove(), but without special treatment of '.'. This allows e.g. URLs // to be used as paths. virtual bool RemoveWithoutPathExpansion(const std::string& key, - scoped_ptr<Value>* out_value); + std::unique_ptr<Value>* out_value); // Removes a path, clearing out all dictionaries on |path| that remain empty // after removing the value at |path|. virtual bool RemovePath(const std::string& path, - scoped_ptr<Value>* out_value); + std::unique_ptr<Value>* out_value); // Makes a copy of |this| but doesn't include empty dictionaries and lists in // the copy. This never returns NULL, even if |this| itself is empty. - scoped_ptr<DictionaryValue> DeepCopyWithoutEmptyChildren() const; + std::unique_ptr<DictionaryValue> DeepCopyWithoutEmptyChildren() const; // Merge |dictionary| into this dictionary. This is done recursively, i.e. any // sub-dictionaries will be merged as well. In case of key collisions, the @@ -365,7 +366,7 @@ class BASE_EXPORT DictionaryValue : public Value { // Overridden from Value: DictionaryValue* DeepCopy() const override; // Preferred version of DeepCopy. TODO(estade): remove the above. - scoped_ptr<DictionaryValue> CreateDeepCopy() const; + std::unique_ptr<DictionaryValue> CreateDeepCopy() const; bool Equals(const Value* other) const override; private: @@ -381,7 +382,7 @@ class BASE_EXPORT ListValue : public Value { typedef ValueVector::const_iterator const_iterator; // Returns |value| if it is a list, nullptr otherwise. - static scoped_ptr<ListValue> From(scoped_ptr<Value> value); + static std::unique_ptr<ListValue> From(std::unique_ptr<Value> value); ListValue(); ~ListValue() override; @@ -402,7 +403,7 @@ class BASE_EXPORT ListValue : public Value { // the value is a null pointer. bool Set(size_t index, Value* in_value); // Preferred version of the above. TODO(estade): remove the above. - bool Set(size_t index, scoped_ptr<Value> in_value); + bool Set(size_t index, std::unique_ptr<Value> in_value); // Gets the Value at the given index. Modifies |out_value| (and returns true) // only if the index falls within the current list range. @@ -433,7 +434,7 @@ class BASE_EXPORT ListValue : public Value { // passed out via |out_value|. If |out_value| is NULL, the removed value will // be deleted. This method returns true if |index| is valid; otherwise // it will return false and the ListValue object will be unchanged. - virtual bool Remove(size_t index, scoped_ptr<Value>* out_value); + virtual bool Remove(size_t index, std::unique_ptr<Value>* out_value); // Removes the first instance of |value| found in the list, if any, and // deletes it. |index| is the location where |value| was found. Returns false @@ -444,10 +445,10 @@ class BASE_EXPORT ListValue : public Value { // deleted, otherwise ownership of the value is passed back to the caller. // Returns an iterator pointing to the location of the element that // followed the erased element. - iterator Erase(iterator iter, scoped_ptr<Value>* out_value); + iterator Erase(iterator iter, std::unique_ptr<Value>* out_value); // Appends a Value to the end of the list. - void Append(scoped_ptr<Value> in_value); + void Append(std::unique_ptr<Value> in_value); // Deprecated version of the above. TODO(estade): remove. void Append(Value* in_value); @@ -489,7 +490,7 @@ class BASE_EXPORT ListValue : public Value { bool Equals(const Value* other) const override; // Preferred version of DeepCopy. TODO(estade): remove DeepCopy. - scoped_ptr<ListValue> CreateDeepCopy() const; + std::unique_ptr<ListValue> CreateDeepCopy() const; private: ValueVector list_; |