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

Unified Diff: chrome/browser/io_thread.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
Index: chrome/browser/io_thread.cc
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 43eb98bc37d1adc677b525b7ddc2698acf059258..c0fb93609a2ea8970d26e127e152e4ed1d72809f 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -314,16 +314,14 @@ void ConfigureSpdyGlobalsFromUseSpdyArgument(const std::string& mode,
static const char kDisableAltProtocols[] = "no-alt-protocols";
static const char kInitialMaxConcurrentStreams[] = "init-max-streams";
- std::vector<std::string> spdy_options;
- base::SplitString(mode, ',', &spdy_options);
-
- for (const std::string& element : spdy_options) {
- std::vector<std::string> name_value;
- base::SplitString(element, '=', &name_value);
- const std::string& option =
- name_value.size() > 0 ? name_value[0] : std::string();
- const std::string value =
- name_value.size() > 1 ? name_value[1] : std::string();
+ for (const base::StringPiece& element : base::SplitStringPiece(
+ mode, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
+ std::vector<base::StringPiece> name_value = base::SplitStringPiece(
+ element, "=", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
+ const base::StringPiece option =
+ name_value.size() > 0 ? name_value[0] : base::StringPiece();
+ const base::StringPiece value =
+ name_value.size() > 1 ? name_value[1] : base::StringPiece();
if (option == kOff) {
net::HttpStreamFactory::set_spdy_enabled(false);
@@ -335,7 +333,7 @@ void ConfigureSpdyGlobalsFromUseSpdyArgument(const std::string& mode,
}
if (option == kExclude) {
globals->forced_spdy_exclusions.insert(
- net::HostPortPair::FromURL(GURL(value)));
+ net::HostPortPair::FromURL(GURL(value.as_string())));
continue;
}
if (option == kDisableCompression) {
@@ -353,7 +351,7 @@ void ConfigureSpdyGlobalsFromUseSpdyArgument(const std::string& mode,
continue;
}
}
- LOG(DFATAL) << "Unrecognized spdy option: " << option;
+ LOG(DFATAL) << "Unrecognized spdy option: " << option.as_string();
}
}
@@ -688,13 +686,10 @@ void IOThread::Init() {
if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) {
std::string switch_value = command_line.GetSwitchValueASCII(
switches::kCertificateTransparencyLog);
- std::vector<std::string> logs;
- base::SplitString(switch_value, ',', &logs);
- for (std::vector<std::string>::iterator it = logs.begin(); it != logs.end();
- ++it) {
- const std::string& curr_log = *it;
- std::vector<std::string> log_metadata;
- base::SplitString(curr_log, ':', &log_metadata);
+ for (const base::StringPiece& curr_log : base::SplitStringPiece(
+ switch_value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
+ std::vector<std::string> log_metadata = base::SplitString(
+ curr_log, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
CHECK_GE(log_metadata.size(), 3u)
<< "CT log metadata missing: Switch format is "
<< "'description:base64_key:url_without_schema'.";
« no previous file with comments | « chrome/browser/extensions/updater/extension_updater_unittest.cc ('k') | chrome/browser/media/webrtc_log_uploader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698