Index: base/values.cc |
diff --git a/base/values.cc b/base/values.cc |
index 0e1e2b1bdd7740f442d0327dd472d5d9ea37946e..4093eba67aaf39be6ef8f648e49dfebacce1c39c 100644 |
--- a/base/values.cc |
+++ b/base/values.cc |
@@ -85,8 +85,8 @@ Value::~Value() { |
} |
// static |
-Value* Value::CreateNullValue() { |
- return new Value(TYPE_NULL); |
+scoped_ptr<Value> Value::CreateNullValue() { |
+ return make_scoped_ptr(new Value(TYPE_NULL)); |
} |
bool Value::GetAsBinary(const BinaryValue** out_value) const { |
@@ -137,7 +137,11 @@ Value* Value::DeepCopy() const { |
// This method should only be getting called for null Values--all subclasses |
// need to provide their own implementation;. |
DCHECK(IsType(TYPE_NULL)); |
- return CreateNullValue(); |
+ return CreateNullValue().release(); |
+} |
+ |
+scoped_ptr<Value> Value::CreateDeepCopy() const { |
+ return make_scoped_ptr(DeepCopy()); |
} |
bool Value::Equals(const Value* other) const { |
@@ -829,6 +833,10 @@ DictionaryValue* DictionaryValue::DeepCopy() const { |
return result; |
} |
+scoped_ptr<DictionaryValue> DictionaryValue::CreateDeepCopy() const { |
+ return make_scoped_ptr(DeepCopy()); |
+} |
+ |
bool DictionaryValue::Equals(const Value* other) const { |
if (other->GetType() != GetType()) |
return false; |
@@ -883,6 +891,10 @@ bool ListValue::Set(size_t index, Value* in_value) { |
return true; |
} |
+bool ListValue::Set(size_t index, scoped_ptr<Value> in_value) { |
+ return Set(index, in_value.release()); |
+} |
+ |
bool ListValue::Get(size_t index, const Value** out_value) const { |
if (index >= list_.size()) |
return false; |
@@ -1032,6 +1044,10 @@ ListValue::iterator ListValue::Erase(iterator iter, |
return list_.erase(iter); |
} |
+void ListValue::Append(scoped_ptr<Value> in_value) { |
+ Append(in_value.release()); |
+} |
+ |
void ListValue::Append(Value* in_value) { |
DCHECK(in_value); |
list_.push_back(in_value); |
@@ -1121,6 +1137,10 @@ ListValue* ListValue::DeepCopy() const { |
return result; |
} |
+scoped_ptr<ListValue> ListValue::CreateDeepCopy() const { |
+ return make_scoped_ptr(DeepCopy()); |
+} |
+ |
bool ListValue::Equals(const Value* other) const { |
if (other->GetType() != GetType()) |
return false; |