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

Unified Diff: extensions/common/value_builder.h

Issue 1908953003: Convert //extensions/{common,shell} from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? 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 | « extensions/common/url_pattern_unittest.cc ('k') | extensions/common/value_builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/value_builder.h
diff --git a/extensions/common/value_builder.h b/extensions/common/value_builder.h
index 27c4e0165c6cb95f63ee2c0f45ced2264617459d..4b4061bfe232a3f98a76cc57c79ff53143423cad 100644
--- a/extensions/common/value_builder.h
+++ b/extensions/common/value_builder.h
@@ -8,7 +8,7 @@
//
// The pattern is to write:
//
-// scoped_ptr<BuiltType> result(FooBuilder()
+// std::unique_ptr<BuiltType> result(FooBuilder()
// .Set(args)
// .Set(args)
// .Build());
@@ -23,11 +23,11 @@
#ifndef EXTENSIONS_COMMON_VALUE_BUILDER_H_
#define EXTENSIONS_COMMON_VALUE_BUILDER_H_
+#include <memory>
#include <string>
#include <utility>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
namespace base {
@@ -47,7 +47,7 @@ class DictionaryBuilder {
~DictionaryBuilder();
// Can only be called once, after which it's invalid to use the builder.
- scoped_ptr<base::DictionaryValue> Build() { return std::move(dict_); }
+ std::unique_ptr<base::DictionaryValue> Build() { return std::move(dict_); }
// Immediately serializes the current state to JSON. Can be called as many
// times as you like.
@@ -59,14 +59,14 @@ class DictionaryBuilder {
DictionaryBuilder& Set(const std::string& path,
const base::string16& in_value);
DictionaryBuilder& Set(const std::string& path,
- scoped_ptr<base::Value> in_value);
+ std::unique_ptr<base::Value> in_value);
// Named differently because overload resolution is too eager to
// convert implicitly to bool.
DictionaryBuilder& SetBoolean(const std::string& path, bool in_value);
private:
- scoped_ptr<base::DictionaryValue> dict_;
+ std::unique_ptr<base::DictionaryValue> dict_;
};
class ListBuilder {
@@ -76,20 +76,20 @@ class ListBuilder {
~ListBuilder();
// Can only be called once, after which it's invalid to use the builder.
- scoped_ptr<base::ListValue> Build() { return std::move(list_); }
+ std::unique_ptr<base::ListValue> Build() { return std::move(list_); }
ListBuilder& Append(int in_value);
ListBuilder& Append(double in_value);
ListBuilder& Append(const std::string& in_value);
ListBuilder& Append(const base::string16& in_value);
- ListBuilder& Append(scoped_ptr<base::Value> in_value);
+ ListBuilder& Append(std::unique_ptr<base::Value> in_value);
// Named differently because overload resolution is too eager to
// convert implicitly to bool.
ListBuilder& AppendBoolean(bool in_value);
private:
- scoped_ptr<base::ListValue> list_;
+ std::unique_ptr<base::ListValue> list_;
DISALLOW_COPY_AND_ASSIGN(ListBuilder);
};
« no previous file with comments | « extensions/common/url_pattern_unittest.cc ('k') | extensions/common/value_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698