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

Unified Diff: chrome/browser/predictors/resource_prefetch_common.cc

Issue 1240183002: Update SplitString calls in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « chrome/browser/net/safe_search_util.cc ('k') | chrome/browser/prefs/command_line_pref_store.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/predictors/resource_prefetch_common.cc
diff --git a/chrome/browser/predictors/resource_prefetch_common.cc b/chrome/browser/predictors/resource_prefetch_common.cc
index 1ec32e1870ce69b8805eafc9a8859051653c1386..1fd2c097e909bf2e41fc05f9cb41227dfbe01bec 100644
--- a/chrome/browser/predictors/resource_prefetch_common.cc
+++ b/chrome/browser/predictors/resource_prefetch_common.cc
@@ -34,17 +34,15 @@ const char kSpeculativePrefetchingTrialName[] =
* The function below extracts the value corresponding to a key provided from
* the SpeculativeResourcePrefetching field trial.
*/
-string GetFiledTrialSpecValue(string key) {
- vector<string> elements;
- base::SplitString(
- FieldTrialList::FindFullName(kSpeculativePrefetchingTrialName),
- ':',
- &elements);
- for (int i = 0; i < static_cast<int>(elements.size()); i++) {
- vector<string> key_value;
- base::SplitString(elements[i], '=', &key_value);
+std::string GetFiledTrialSpecValue(string key) {
+ std::string trial_name =
+ FieldTrialList::FindFullName(kSpeculativePrefetchingTrialName);
+ for (const base::StringPiece& element : base::SplitStringPiece(
+ trial_name, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
+ std::vector<base::StringPiece> key_value = base::SplitStringPiece(
+ element, "=", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (key_value.size() == 2 && key_value[0] == key)
- return key_value[1];
+ return key_value[1].as_string();
}
return string();
}
« no previous file with comments | « chrome/browser/net/safe_search_util.cc ('k') | chrome/browser/prefs/command_line_pref_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698