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

Unified Diff: components/policy/core/common/schema.cc

Issue 1902633006: Convert //components/policy from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments and use namespace alias 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
Index: components/policy/core/common/schema.cc
diff --git a/components/policy/core/common/schema.cc b/components/policy/core/common/schema.cc
index 7eedffd0c61a318df2d5fddaed494d4d9f1202e0..9af816ebafaa9d3b80c7aa9ee873f75d5cf1f782 100644
--- a/components/policy/core/common/schema.cc
+++ b/components/policy/core/common/schema.cc
@@ -10,12 +10,12 @@
#include <algorithm>
#include <climits>
#include <map>
+#include <memory>
#include <utility>
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "components/json_schema/json_schema_constants.h"
@@ -250,7 +250,7 @@ class Schema::InternalStorage
// Cache for CompileRegex(), will memorize return value of every call to
// CompileRegex() and return results directly next time.
- mutable std::map<std::string, scoped_ptr<re2::RE2>> regex_cache_;
+ mutable std::map<std::string, std::unique_ptr<re2::RE2>> regex_cache_;
SchemaData schema_data_;
std::vector<std::string> strings_;
@@ -347,7 +347,7 @@ re2::RE2* Schema::InternalStorage::CompileRegex(
const std::string& pattern) const {
auto it = regex_cache_.find(pattern);
if (it == regex_cache_.end()) {
- scoped_ptr<re2::RE2> compiled(new re2::RE2(pattern));
+ std::unique_ptr<re2::RE2> compiled(new re2::RE2(pattern));
re2::RE2* compiled_ptr = compiled.get();
regex_cache_.insert(std::make_pair(pattern, std::move(compiled)));
return compiled_ptr;
@@ -955,8 +955,10 @@ bool Schema::Normalize(base::Value* value,
Schema Schema::Parse(const std::string& content, std::string* error) {
// Validate as a generic JSON schema, and ignore unknown attributes; they
// may become used in a future version of the schema format.
- scoped_ptr<base::DictionaryValue> dict = JSONSchemaValidator::IsValidSchema(
- content, JSONSchemaValidator::OPTIONS_IGNORE_UNKNOWN_ATTRIBUTES, error);
+ std::unique_ptr<base::DictionaryValue> dict =
+ JSONSchemaValidator::IsValidSchema(
+ content, JSONSchemaValidator::OPTIONS_IGNORE_UNKNOWN_ATTRIBUTES,
+ error);
if (!dict)
return Schema();

Powered by Google App Engine
This is Rietveld 408576698