summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorpkasting <pkasting@chromium.org>2015-08-06 18:29:50 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-07 01:30:28 +0000
commitc4afb05f67511e980cd13c021abf26e04b902977 (patch)
tree125f79c7a354095c4519128b0fe2c9983f644152 /base
parentac97e8e270e8783230272fa07d18d360d2409d5f (diff)
downloadchromium_src-c4afb05f67511e980cd13c021abf26e04b902977.zip
chromium_src-c4afb05f67511e980cd13c021abf26e04b902977.tar.gz
chromium_src-c4afb05f67511e980cd13c021abf26e04b902977.tar.bz2
Revert of Update SplitString calls to new form (patchset #5 id:80001 of https://codereview.chromium.org/1272823003/ )
Reason for revert: Caused Blink layout test failures in media/encrypted-media/encrypted-media-requestmediakeysystemaccess.html : http://test-results.appspot.com/dashboards/flakiness_dashboard.html#showExpectations=true&tests=media%2Fencrypted-media%2Fencrypted-media-requestmediakeysystemaccess.html Original issue's description: > Update SplitString calls to new form > > Uses the new form for most (but not quite all) of the remaining users of the old form. > > Changes media mime util codec list parsing to expect no result from the string "," rather than two empty strings. The old SplitString call had a special case where if the input was empty, it would return empty, but if it had one split character, it would return two empty strings as results. > > The new one lets you choose but the options are either (1) empty string -> one empty string and "," -> two empty strings, or (2) map both to no results for when you don't want empty results. I'm pretty sure media codec parsing actually wants the latter behavior, so I updated the call to discard empty results and MimeUtilTest.ParseCodecString is updated. > > Committed: https://crrev.com/0aa7c64253cca8b636d52d1d01d94f96ab9c13fa > Cr-Commit-Position: refs/heads/master@{#342238} TBR=sky@chromium.org,dalecurtis@chromium.org,brettw@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1278973003 Cr-Commit-Position: refs/heads/master@{#342257}
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, 21 insertions, 30 deletions
diff --git a/base/command_line.cc b/base/command_line.cc
index 95ff644..3fcf22a 100644
--- a/base/command_line.cc
+++ b/base/command_line.cc
@@ -394,9 +394,8 @@ 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, FilePath::StringType(1, ' '), base::TRIM_WHITESPACE,
- base::SPLIT_WANT_ALL);
+ StringVector wrapper_argv;
+ SplitString(wrapper, FILE_PATH_LITERAL(' '), &wrapper_argv);
// 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 8c8965b..4c1aedf 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", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
+ std::vector<std::string> lines;
+ SplitString(input, '\n', &lines);
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 e6c2119..4f3fcac 100644
--- a/base/process/internal_linux.cc
+++ b/base/process/internal_linux.cc
@@ -97,9 +97,8 @@ 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), " ",
- base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
+ std::vector<std::string> other_stats;
+ SplitString(stats_data.substr(close_parens_idx + 2), ' ', &other_stats);
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 b282ff0..47a79e5 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<StringPiece> split_value_str = SplitStringPiece(
- value_str, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
+ std::vector<std::string> split_value_str;
+ SplitString(value_str, ' ', &split_value_str);
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<StringPiece> statm_vec = SplitStringPiece(
- statm, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
+ std::vector<std::string> statm_vec;
+ SplitString(statm, ' ', &statm_vec);
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 4cf2d1d..29ebca7 100644
--- a/base/test/launcher/test_launcher.cc
+++ b/base/test/launcher/test_launcher.cc
@@ -561,9 +561,8 @@ void TestLauncher::OnTestFinished(const TestResult& result) {
<< ": " << print_test_stdio;
}
if (print_snippet) {
- std::vector<std::string> snippet_lines = SplitString(
- result.output_snippet, "\n", base::KEEP_WHITESPACE,
- base::SPLIT_WANT_ALL);
+ std::vector<std::string> snippet_lines;
+ SplitStringDontTrim(result.output_snippet, '\n', &snippet_lines);
if (snippet_lines.size() > kOutputSnippetLinesLimit) {
size_t truncated_size = snippet_lines.size() - kOutputSnippetLinesLimit;
snippet_lines.erase(
@@ -792,8 +791,8 @@ bool TestLauncher::Init() {
return false;
}
- std::vector<std::string> filter_lines = SplitString(
- filter, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
+ std::vector<std::string> filter_lines;
+ SplitString(filter, '\n', &filter_lines);
for (size_t i = 0; i < filter_lines.size(); i++) {
if (filter_lines[i].empty())
continue;
@@ -809,18 +808,13 @@ bool TestLauncher::Init() {
std::string filter = command_line->GetSwitchValueASCII(kGTestFilterFlag);
size_t dash_pos = filter.find('-');
if (dash_pos == std::string::npos) {
- positive_test_filter_ = SplitString(
- filter, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
+ SplitString(filter, ':', &positive_test_filter_);
} else {
// Everything up to the dash.
- positive_test_filter_ = SplitString(
- filter.substr(0, dash_pos), ":", base::TRIM_WHITESPACE,
- base::SPLIT_WANT_ALL);
+ SplitString(filter.substr(0, dash_pos), ':', &positive_test_filter_);
// Everything after the dash.
- negative_test_filter_ = SplitString(
- filter.substr(dash_pos + 1), ":", base::TRIM_WHITESPACE,
- base::SPLIT_WANT_ALL);
+ SplitString(filter.substr(dash_pos + 1), ':', &negative_test_filter_);
}
}
diff --git a/base/trace_event/trace_config.cc b/base/trace_event/trace_config.cc
index 974e40f..2a15ec5 100644
--- a/base/trace_event/trace_config.cc
+++ b/base/trace_event/trace_config.cc
@@ -293,10 +293,9 @@ 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 = base::SplitString(
- category_filter_string, ",", base::TRIM_WHITESPACE,
- base::SPLIT_WANT_ALL);
+ std::vector<std::string> split;
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.
@@ -332,9 +331,9 @@ void TraceConfig::InitializeFromStrings(
enable_systrace_ = false;
enable_argument_filter_ = false;
if(!trace_options_string.empty()) {
- std::vector<std::string> split = base::SplitString(
- trace_options_string, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
+ std::vector<std::string> split;
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;