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

Unified Diff: chrome/test/base/chrome_process_util_mac.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/service/cloud_print/cloud_print_connector.cc ('k') | chrome/test/chromedriver/capabilities.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/chrome_process_util_mac.cc
diff --git a/chrome/test/base/chrome_process_util_mac.cc b/chrome/test/base/chrome_process_util_mac.cc
index 907344890e230176b6038de467db08ddaf7655f0..cb19bc404fa441d067ba96f508e27d1ccc4a747c 100644
--- a/chrome/test/base/chrome_process_util_mac.cc
+++ b/chrome/test/base/chrome_process_util_mac.cc
@@ -35,16 +35,12 @@ MacChromeProcessInfoList GetRunningMacProcessInfo(
if (!base::GetAppOutput(base::CommandLine(cmdline), &ps_output))
return result; // All the pids might have exited
- // Process the results
- std::vector<std::string> ps_output_lines;
- base::SplitString(ps_output, '\n', &ps_output_lines);
- std::vector<std::string>::const_iterator line_iter;
- for (line_iter = ps_output_lines.begin();
- line_iter != ps_output_lines.end();
- ++line_iter) {
- std::string line(base::CollapseWhitespaceASCII(*line_iter, false));
- std::vector<std::string> values;
- base::SplitString(line, ' ', &values);
+ // Process the results.
+ for (const std::string& raw_line : base::SplitString(
+ ps_output, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
+ std::string line(base::CollapseWhitespaceASCII(raw_line, false));
+ std::vector<base::StringPiece> values = base::SplitStringPiece(
+ line, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (values.size() == 3) {
MacChromeProcessInfo proc_info;
int pid;
« no previous file with comments | « chrome/service/cloud_print/cloud_print_connector.cc ('k') | chrome/test/chromedriver/capabilities.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698