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

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

Issue 1468013002: ScopedPtrMap -> std::map from /component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 5 years, 1 month 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 d842773e8e4a354e737689cb3ac104ef46b5d4c2..55d9579238c5a2629ed67f5ed684f43370693832 100644
--- a/components/policy/core/common/schema.cc
+++ b/components/policy/core/common/schema.cc
@@ -10,9 +10,9 @@
#include <utility>
#include "base/compiler_specific.h"
-#include "base/containers/scoped_ptr_map.h"
#include "base/logging.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"
#include "components/json_schema/json_schema_validator.h"
@@ -246,7 +246,7 @@ class Schema::InternalStorage
// Cache for CompileRegex(), will memorize return value of every call to
// CompileRegex() and return results directly next time.
- mutable base::ScopedPtrMap<std::string, scoped_ptr<re2::RE2>> regex_cache_;
+ mutable std::map<std::string, scoped_ptr<re2::RE2>> regex_cache_;
SchemaData schema_data_;
std::vector<std::string> strings_;
@@ -341,15 +341,14 @@ Schema::InternalStorage::ParseSchema(const base::DictionaryValue& schema,
re2::RE2* Schema::InternalStorage::CompileRegex(
const std::string& pattern) const {
- base::ScopedPtrMap<std::string, scoped_ptr<re2::RE2>>::const_iterator it =
- regex_cache_.find(pattern);
+ auto it = regex_cache_.find(pattern);
if (it == regex_cache_.end()) {
scoped_ptr<re2::RE2> compiled(new re2::RE2(pattern));
re2::RE2* compiled_ptr = compiled.get();
- regex_cache_.insert(pattern, compiled.Pass());
+ regex_cache_.insert(std::make_pair(pattern, std::move(compiled)));
return compiled_ptr;
}
- return it->second;
+ return it->second.get();
}
// static
« no previous file with comments | « components/page_load_metrics/browser/metrics_web_contents_observer.cc ('k') | components/sync_driver/device_info_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698