summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorbrettw <brettw@chromium.org>2015-08-07 17:28:47 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-08 00:29:27 +0000
commit26dab8f049217794bd73a230ea567021adc09672 (patch)
tree226dec9ffde922a61c6d05f0d8ee549f0a9dd02d /base
parentdbae293445fa5a6c8ba5cea0c7290f436d1034ab (diff)
downloadchromium_src-26dab8f049217794bd73a230ea567021adc09672.zip
chromium_src-26dab8f049217794bd73a230ea567021adc09672.tar.gz
chromium_src-26dab8f049217794bd73a230ea567021adc09672.tar.bz2
Update SplitString calls to new form
Uses the new form for most (but not quite all) of the remaining users of the old form. Reland of https://codereview.chromium.org/1272823003 but with no changes to the way media parses codec lists. The previous landing attempted to simplify some handling but there are layout tests that expect the old behavior, and I'm not qualified to tell if it's OK to change. TBR=sky Review URL: https://codereview.chromium.org/1274123003 Cr-Commit-Position: refs/heads/master@{#342489}
Diffstat (limited to 'base')
-rw-r--r--base/command_line.cc5
-rw-r--r--base/debug/proc_maps_linux.cc4
-rw-r--r--base/process/internal_linux.cc5
-rw-r--r--base/process/process_metrics_linux.cc8
-rw-r--r--base/test/launcher/test_launcher.cc20
-rw-r--r--base/trace_event/trace_config.cc9
6 files changed, 30 insertions, 21 deletions
diff --git a/base/command_line.cc b/base/command_line.cc
index 3fcf22a..95ff644 100644
--- a/base/command_line.cc
+++ b/base/command_line.cc
@@ -394,8 +394,9 @@ void CommandLine::PrependWrapper(const CommandLine::StringType& wrapper) {
return;
// The wrapper may have embedded arguments (like "gdb --args"). In this case,
// we don't pretend to do anything fancy, we just split on spaces.
- StringVector wrapper_argv;
- SplitString(wrapper, FILE_PATH_LITERAL(' '), &wrapper_argv);
+ StringVector wrapper_argv = SplitString(
+ wrapper, FilePath::StringType(1, ' '), base::TRIM_WHITESPACE,
+ base::SPLIT_WANT_ALL);
// Prepend the wrapper and update the switches/arguments |begin_args_|.
argv_.insert(argv_.begin(), wrapper_argv.begin(), wrapper_argv.end());
begin_args_ += wrapper_argv.size();
diff --git a/base/debug/proc_maps_linux.cc b/base/debug/proc_maps_linux.cc
index 4c1aedf..8c8965b 100644
--- a/base/debug/proc_maps_linux.cc
+++ b/base/debug/proc_maps_linux.cc
@@ -96,8 +96,8 @@ bool ParseProcMaps(const std::string& input,
// This isn't async safe nor terribly efficient, but it doesn't need to be at
// this point in time.
- std::vector<std::string> lines;
- SplitString(input, '\n', &lines);
+ std::vector<std::string> lines = SplitString(
+ input, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
for (size_t i = 0; i < lines.size(); ++i) {
// Due to splitting on '\n' the last line should be empty.
diff --git a/base/process/internal_linux.cc b/base/process/internal_linux.cc
index 4f3fcac..e6c2119 100644
--- a/base/process/internal_linux.cc
+++ b/base/process/internal_linux.cc
@@ -97,8 +97,9 @@ bool ParseProcStats(const std::string& stats_data,
close_parens_idx - (open_parens_idx + 1)));
// Split the rest.
- std::vector<std::string> other_stats;
- SplitString(stats_data.substr(close_parens_idx + 2), ' ', &other_stats);
+ std::vector<std::string> other_stats = SplitString(
+ stats_data.substr(close_parens_idx + 2), " ",
+ base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
for (size_t i = 0; i < other_stats.size(); ++i)
proc_stats->push_back(other_stats[i]);
return true;
diff --git a/base/process/process_metrics_linux.cc b/base/process/process_metrics_linux.cc
index 47a79e5..b282ff0 100644
--- a/base/process/process_metrics_linux.cc
+++ b/base/process/process_metrics_linux.cc
@@ -67,8 +67,8 @@ size_t ReadProcStatusAndGetFieldAsSizeT(pid_t pid, const std::string& field) {
const std::string& key = pairs[i].first;
const std::string& value_str = pairs[i].second;
if (key == field) {
- std::vector<std::string> split_value_str;
- SplitString(value_str, ' ', &split_value_str);
+ std::vector<StringPiece> split_value_str = SplitStringPiece(
+ value_str, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (split_value_str.size() != 2 || split_value_str[1] != "kB") {
NOTREACHED();
return 0;
@@ -368,8 +368,8 @@ bool ProcessMetrics::GetWorkingSetKBytesStatm(WorkingSetKBytes* ws_usage)
return false;
}
- std::vector<std::string> statm_vec;
- SplitString(statm, ' ', &statm_vec);
+ std::vector<StringPiece> statm_vec = SplitStringPiece(
+ statm, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (statm_vec.size() != 7)
return false; // Not the format we expect.
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc
index 29ebca7..4cf2d1d 100644
--- a/base/test/launcher/test_launcher.cc
+++ b/base/test/launcher/test_launcher.cc
@@ -561,8 +561,9 @@ void TestLauncher::OnTestFinished(const TestResult& result) {
<< ": " << print_test_stdio;
}
if (print_snippet) {
- std::vector<std::string> snippet_lines;
- SplitStringDontTrim(result.output_snippet, '\n', &snippet_lines);
+ std::vector<std::string> snippet_lines = SplitString(
+ result.output_snippet, "\n", base::KEEP_WHITESPACE,
+ base::SPLIT_WANT_ALL);
if (snippet_lines.size() > kOutputSnippetLinesLimit) {
size_t truncated_size = snippet_lines.size() - kOutputSnippetLinesLimit;
snippet_lines.erase(
@@ -791,8 +792,8 @@ bool TestLauncher::Init() {
return false;
}
- std::vector<std::string> filter_lines;
- SplitString(filter, '\n', &filter_lines);
+ std::vector<std::string> filter_lines = SplitString(
+ filter, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
for (size_t i = 0; i < filter_lines.size(); i++) {
if (filter_lines[i].empty())
continue;
@@ -808,13 +809,18 @@ bool TestLauncher::Init() {
std::string filter = command_line->GetSwitchValueASCII(kGTestFilterFlag);
size_t dash_pos = filter.find('-');
if (dash_pos == std::string::npos) {
- SplitString(filter, ':', &positive_test_filter_);
+ positive_test_filter_ = SplitString(
+ filter, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
} else {
// Everything up to the dash.
- SplitString(filter.substr(0, dash_pos), ':', &positive_test_filter_);
+ positive_test_filter_ = SplitString(
+ filter.substr(0, dash_pos), ":", base::TRIM_WHITESPACE,
+ base::SPLIT_WANT_ALL);
// Everything after the dash.
- SplitString(filter.substr(dash_pos + 1), ':', &negative_test_filter_);
+ negative_test_filter_ = SplitString(
+ filter.substr(dash_pos + 1), ":", base::TRIM_WHITESPACE,
+ base::SPLIT_WANT_ALL);
}
}
diff --git a/base/trace_event/trace_config.cc b/base/trace_event/trace_config.cc
index 2a15ec5..974e40f 100644
--- a/base/trace_event/trace_config.cc
+++ b/base/trace_event/trace_config.cc
@@ -293,9 +293,10 @@ void TraceConfig::InitializeFromStrings(
const std::string& category_filter_string,
const std::string& trace_options_string) {
if (!category_filter_string.empty()) {
- std::vector<std::string> split;
+ std::vector<std::string> split = base::SplitString(
+ category_filter_string, ",", base::TRIM_WHITESPACE,
+ base::SPLIT_WANT_ALL);
std::vector<std::string>::iterator iter;
- base::SplitString(category_filter_string, ',', &split);
for (iter = split.begin(); iter != split.end(); ++iter) {
std::string category = *iter;
// Ignore empty categories.
@@ -331,9 +332,9 @@ void TraceConfig::InitializeFromStrings(
enable_systrace_ = false;
enable_argument_filter_ = false;
if(!trace_options_string.empty()) {
- std::vector<std::string> split;
+ std::vector<std::string> split = base::SplitString(
+ trace_options_string, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
std::vector<std::string>::iterator iter;
- base::SplitString(trace_options_string, ',', &split);
for (iter = split.begin(); iter != split.end(); ++iter) {
if (*iter == kRecordUntilFull) {
record_mode_ = RECORD_UNTIL_FULL;