aboutsummaryrefslogtreecommitdiff
path: root/third_party/chromium/base/values.h
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/chromium/base/values.h')
-rw-r--r--third_party/chromium/base/values.h39
1 files changed, 19 insertions, 20 deletions
diff --git a/third_party/chromium/base/values.h b/third_party/chromium/base/values.h
index fca5239..36e24cc 100644
--- a/third_party/chromium/base/values.h
+++ b/third_party/chromium/base/values.h
@@ -22,7 +22,6 @@
#include <iosfwd>
#include <map>
-#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -30,6 +29,7 @@
#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 std::unique_ptr<Value> CreateNullValue();
+ static scoped_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.
- std::unique_ptr<Value> CreateDeepCopy() const;
+ scoped_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(std::unique_ptr<char[]> buffer, size_t size);
+ BinaryValue(scoped_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:
- std::unique_ptr<char[]> buffer_;
+ scoped_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 std::unique_ptr<DictionaryValue> From(std::unique_ptr<Value> value);
+ static scoped_ptr<DictionaryValue> From(scoped_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, std::unique_ptr<Value> in_value);
+ void Set(const std::string& path, scoped_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,
- std::unique_ptr<Value> in_value);
+ scoped_ptr<Value> in_value);
// Deprecated version of the above. TODO(estade): remove.
void SetWithoutPathExpansion(const std::string& key, Value* in_value);
@@ -317,22 +317,21 @@ 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,
- std::unique_ptr<Value>* out_value);
+ virtual bool Remove(const std::string& path, scoped_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,
- std::unique_ptr<Value>* out_value);
+ scoped_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,
- std::unique_ptr<Value>* out_value);
+ scoped_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.
- std::unique_ptr<DictionaryValue> DeepCopyWithoutEmptyChildren() const;
+ scoped_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
@@ -366,7 +365,7 @@ class BASE_EXPORT DictionaryValue : public Value {
// Overridden from Value:
DictionaryValue* DeepCopy() const override;
// Preferred version of DeepCopy. TODO(estade): remove the above.
- std::unique_ptr<DictionaryValue> CreateDeepCopy() const;
+ scoped_ptr<DictionaryValue> CreateDeepCopy() const;
bool Equals(const Value* other) const override;
private:
@@ -382,7 +381,7 @@ class BASE_EXPORT ListValue : public Value {
typedef ValueVector::const_iterator const_iterator;
// Returns |value| if it is a list, nullptr otherwise.
- static std::unique_ptr<ListValue> From(std::unique_ptr<Value> value);
+ static scoped_ptr<ListValue> From(scoped_ptr<Value> value);
ListValue();
~ListValue() override;
@@ -403,7 +402,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, std::unique_ptr<Value> in_value);
+ bool Set(size_t index, scoped_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.
@@ -434,7 +433,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, std::unique_ptr<Value>* out_value);
+ virtual bool Remove(size_t index, scoped_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
@@ -445,10 +444,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, std::unique_ptr<Value>* out_value);
+ iterator Erase(iterator iter, scoped_ptr<Value>* out_value);
// Appends a Value to the end of the list.
- void Append(std::unique_ptr<Value> in_value);
+ void Append(scoped_ptr<Value> in_value);
// Deprecated version of the above. TODO(estade): remove.
void Append(Value* in_value);
@@ -490,7 +489,7 @@ class BASE_EXPORT ListValue : public Value {
bool Equals(const Value* other) const override;
// Preferred version of DeepCopy. TODO(estade): remove DeepCopy.
- std::unique_ptr<ListValue> CreateDeepCopy() const;
+ scoped_ptr<ListValue> CreateDeepCopy() const;
private:
ValueVector list_;