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

Unified Diff: components/domain_reliability/util.cc

Issue 2613223002: Remove ScopedVector from base::JSONValueConverter (Closed)
Patch Set: Created 3 years, 11 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/domain_reliability/util.cc
diff --git a/components/domain_reliability/util.cc b/components/domain_reliability/util.cc
index f4af66913019c4356acd43123e80d98505c274de..20bf7568376d19f308afdb0ea494ff82f07c5d1c 100644
--- a/components/domain_reliability/util.cc
+++ b/components/domain_reliability/util.cc
@@ -170,22 +170,23 @@ void GetUploadResultFromResponseDetails(
return;
}
-// N.B. This uses a ScopedVector because that's what JSONValueConverter uses
-// for repeated fields of any type, and Config uses JSONValueConverter to parse
-// JSON configs.
-GURL SanitizeURLForReport(const GURL& beacon_url,
- const GURL& collector_url,
- const ScopedVector<std::string>& path_prefixes) {
+// N.B. This uses a std::vector<std::unique_ptr<>> because that's what
+// JSONValueConverter uses for repeated fields of any type, and Config uses
+// JSONValueConverter to parse JSON configs.
+GURL SanitizeURLForReport(
+ const GURL& beacon_url,
+ const GURL& collector_url,
+ const std::vector<std::unique_ptr<std::string>>& path_prefixes) {
if (CanReportFullBeaconURLToCollector(beacon_url, collector_url))
return beacon_url.GetAsReferrer();
std::string path = beacon_url.path();
const std::string empty_path;
const std::string* longest_path_prefix = &empty_path;
- for (const std::string* path_prefix : path_prefixes) {
+ for (const auto& path_prefix : path_prefixes) {
if (path.substr(0, path_prefix->length()) == *path_prefix &&
path_prefix->length() > longest_path_prefix->length()) {
- longest_path_prefix = path_prefix;
+ longest_path_prefix = path_prefix.get();
}
}

Powered by Google App Engine
This is Rietveld 408576698