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

Unified Diff: components/url_matcher/regex_set_matcher.cc

Issue 2443753003: Remove stl_util's deletion function use from components/url_matcher/. (Closed)
Patch Set: Created 4 years, 2 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/url_matcher/regex_set_matcher.cc
diff --git a/components/url_matcher/regex_set_matcher.cc b/components/url_matcher/regex_set_matcher.cc
index ac48123aaf86a73a950c6f800eb3f24b1de23760..6a22a78919cdbd738e980dfdd92ad4b2b9c912b9 100644
--- a/components/url_matcher/regex_set_matcher.cc
+++ b/components/url_matcher/regex_set_matcher.cc
@@ -7,7 +7,7 @@
#include <stddef.h>
#include "base/logging.h"
-#include "base/stl_util.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "components/url_matcher/substring_set_matcher.h"
#include "third_party/re2/src/re2/filtered_re2.h"
@@ -102,13 +102,15 @@ void RegexSetMatcher::RebuildMatcher() {
// SubstringSetMatcher doesn't own its strings.
for (size_t i = 0; i < strings_to_match.size(); ++i) {
substring_patterns_.push_back(
- new StringPattern(strings_to_match[i], i));
+ base::MakeUnique<StringPattern>(strings_to_match[i], i));
}
- substring_matcher_->RegisterPatterns(substring_patterns_);
+ std::vector<const StringPattern*> patterns;
+ for (const auto& pattern : substring_patterns_)
+ patterns.push_back(pattern.get());
+ substring_matcher_->RegisterPatterns(patterns);
}
void RegexSetMatcher::DeleteSubstringPatterns() {
battre 2016/10/24 11:32:16 I think here should go call to substring_patterns_
Avi (use Gerrit) 2016/10/24 14:38:06 Agreed. I missed that this wasn't a destructor.
- base::STLDeleteElements(&substring_patterns_);
}
} // namespace url_matcher

Powered by Google App Engine
This is Rietveld 408576698