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

Unified Diff: base/json/json_reader.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/json/json_reader.h ('k') | base/json/json_reader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_reader.cc
diff --git a/base/json/json_reader.cc b/base/json/json_reader.cc
index 3ab5f754b72072ce9964b3c8eeb156cc27f6bae4..983508cf4ff457f37b7061ef9e488d5f3f73dce7 100644
--- a/base/json/json_reader.cc
+++ b/base/json/json_reader.cc
@@ -6,6 +6,7 @@
#include "base/json/json_parser.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/values.h"
namespace base {
@@ -43,27 +44,28 @@ JSONReader::~JSONReader() {
}
// static
-scoped_ptr<Value> JSONReader::Read(const StringPiece& json) {
+std::unique_ptr<Value> JSONReader::Read(const StringPiece& json) {
internal::JSONParser parser(JSON_PARSE_RFC);
- return make_scoped_ptr(parser.Parse(json));
+ return WrapUnique(parser.Parse(json));
}
// static
-scoped_ptr<Value> JSONReader::Read(const StringPiece& json, int options) {
+std::unique_ptr<Value> JSONReader::Read(const StringPiece& json, int options) {
internal::JSONParser parser(options);
- return make_scoped_ptr(parser.Parse(json));
+ return WrapUnique(parser.Parse(json));
}
// static
-scoped_ptr<Value> JSONReader::ReadAndReturnError(const StringPiece& json,
- int options,
- int* error_code_out,
- std::string* error_msg_out,
- int* error_line_out,
- int* error_column_out) {
+std::unique_ptr<Value> JSONReader::ReadAndReturnError(
+ const StringPiece& json,
+ int options,
+ int* error_code_out,
+ std::string* error_msg_out,
+ int* error_line_out,
+ int* error_column_out) {
internal::JSONParser parser(options);
- scoped_ptr<Value> root(parser.Parse(json));
+ std::unique_ptr<Value> root(parser.Parse(json));
if (!root) {
if (error_code_out)
*error_code_out = parser.error_code();
@@ -105,8 +107,8 @@ std::string JSONReader::ErrorCodeToString(JsonParseError error_code) {
}
}
-scoped_ptr<Value> JSONReader::ReadToValue(const std::string& json) {
- return make_scoped_ptr(parser_->Parse(json));
+std::unique_ptr<Value> JSONReader::ReadToValue(const std::string& json) {
+ return WrapUnique(parser_->Parse(json));
}
JSONReader::JsonParseError JSONReader::error_code() const {
« no previous file with comments | « base/json/json_reader.h ('k') | base/json/json_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698