Chromium Code Reviews| 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 |