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

Unified Diff: base/trace_event/trace_event_argument.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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/trace_event/trace_event_argument.h ('k') | base/trace_event/trace_event_argument_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_event_argument.cc
diff --git a/base/trace_event/trace_event_argument.cc b/base/trace_event/trace_event_argument.cc
index 6d787c80dad169808a1070372092978c131c2283..f86ac5739e32640f663d8d31e0f322246a49bbb6 100644
--- a/base/trace_event/trace_event_argument.cc
+++ b/base/trace_event/trace_event_argument.cc
@@ -10,6 +10,7 @@
#include "base/bits.h"
#include "base/json/json_writer.h"
+#include "base/memory/ptr_util.h"
#include "base/trace_event/trace_event_memory_overhead.h"
#include "base/values.h"
@@ -234,7 +235,8 @@ void TracedValue::EndArray() {
pickle_.WriteBytes(&kTypeEndArray, 1);
}
-void TracedValue::SetValue(const char* name, scoped_ptr<base::Value> value) {
+void TracedValue::SetValue(const char* name,
+ std::unique_ptr<base::Value> value) {
SetBaseValueWithCopiedName(name, *value);
}
@@ -347,8 +349,8 @@ void TracedValue::AppendBaseValue(const base::Value& value) {
}
}
-scoped_ptr<base::Value> TracedValue::ToBaseValue() const {
- scoped_ptr<DictionaryValue> root(new DictionaryValue);
+std::unique_ptr<base::Value> TracedValue::ToBaseValue() const {
+ std::unique_ptr<DictionaryValue> root(new DictionaryValue);
DictionaryValue* cur_dict = root.get();
ListValue* cur_list = nullptr;
std::vector<Value*> stack;
@@ -362,11 +364,11 @@ scoped_ptr<base::Value> TracedValue::ToBaseValue() const {
auto new_dict = new DictionaryValue();
if (cur_dict) {
cur_dict->SetWithoutPathExpansion(ReadKeyName(it),
- make_scoped_ptr(new_dict));
+ WrapUnique(new_dict));
stack.push_back(cur_dict);
cur_dict = new_dict;
} else {
- cur_list->Append(make_scoped_ptr(new_dict));
+ cur_list->Append(WrapUnique(new_dict));
stack.push_back(cur_list);
cur_list = nullptr;
cur_dict = new_dict;
@@ -387,12 +389,12 @@ scoped_ptr<base::Value> TracedValue::ToBaseValue() const {
auto new_list = new ListValue();
if (cur_dict) {
cur_dict->SetWithoutPathExpansion(ReadKeyName(it),
- make_scoped_ptr(new_list));
+ WrapUnique(new_list));
stack.push_back(cur_dict);
cur_dict = nullptr;
cur_list = new_list;
} else {
- cur_list->Append(make_scoped_ptr(new_list));
+ cur_list->Append(WrapUnique(new_list));
stack.push_back(cur_list);
cur_list = new_list;
}
« no previous file with comments | « base/trace_event/trace_event_argument.h ('k') | base/trace_event/trace_event_argument_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698