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

Unified Diff: base/values.cc

Issue 1141793003: Update from https://crrev.com/329939 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 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/values.h ('k') | base/values_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « base/values.h ('k') | base/values_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698