Chromium Code Reviews| Index: base/values.cc |
| diff --git a/base/values.cc b/base/values.cc |
| index 060bd996af73296150258a765c9ede04a8440ffd..b68346e9bcbb44dcff23126f1e00b86163e31d61 100644 |
| --- a/base/values.cc |
| +++ b/base/values.cc |
| @@ -1081,24 +1081,23 @@ void ListValue::AppendStrings(const std::vector<string16>& in_values) { |
| } |
| } |
| -bool ListValue::AppendIfNotPresent(Value* in_value) { |
| +bool ListValue::AppendIfNotPresent(std::unique_ptr<Value> in_value) { |
| DCHECK(in_value); |
| for (const auto& entry : list_) { |
| - if (entry->Equals(in_value)) { |
| - delete in_value; |
| + if (entry->Equals(in_value.get())) { |
| return false; |
| } |
| } |
| - list_.emplace_back(in_value); |
| + list_.emplace_back(std::move(in_value)); |
|
danakj
2016/09/13 23:58:37
push back? you have the type going into the list a
dcheng
2016/09/14 01:16:51
Done.
|
| return true; |
| } |
| -bool ListValue::Insert(size_t index, Value* in_value) { |
| +bool ListValue::Insert(size_t index, std::unique_ptr<Value> in_value) { |
| DCHECK(in_value); |
| if (index > list_.size()) |
| return false; |
| - list_.insert(list_.begin() + index, WrapUnique(in_value)); |
| + list_.insert(list_.begin() + index, std::move(in_value)); |
| return true; |
| } |