diff options
70 files changed, 272 insertions, 290 deletions
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc index 6c0fca1..dba2e0a 100644 --- a/ash/display/display_manager.cc +++ b/ash/display/display_manager.cc @@ -171,9 +171,11 @@ bool DisplayManager::InitFromCommandLine() { return false; const string size_str = command_line->GetSwitchValueASCII(switches::kAshHostWindowBounds); - for (const std::string& part : base::SplitString( - size_str, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { - info_list.push_back(DisplayInfo::CreateFromSpec(part)); + vector<string> parts; + base::SplitString(size_str, ',', &parts); + for (vector<string>::const_iterator iter = parts.begin(); + iter != parts.end(); ++iter) { + info_list.push_back(DisplayInfo::CreateFromSpec(*iter)); info_list.back().set_native(true); } MaybeInitInternalDisplay(&info_list[0]); diff --git a/ash/test/display_manager_test_api.cc b/ash/test/display_manager_test_api.cc index 9bad891..77d88ec 100644 --- a/ash/test/display_manager_test_api.cc +++ b/ash/test/display_manager_test_api.cc @@ -34,8 +34,8 @@ std::vector<DisplayInfo> CreateDisplayInfoListFromString( const std::string specs, DisplayManager* display_manager) { std::vector<DisplayInfo> display_info_list; - std::vector<std::string> parts = base::SplitString( - specs, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> parts; + base::SplitString(specs, ',', &parts); size_t index = 0; DisplayManager::DisplayList list = 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; diff --git a/content/browser/accessibility/browser_accessibility_win.cc b/content/browser/accessibility/browser_accessibility_win.cc index 277af2c..deb97ef 100644 --- a/content/browser/accessibility/browser_accessibility_win.cc +++ b/content/browser/accessibility/browser_accessibility_win.cc @@ -969,9 +969,8 @@ STDMETHODIMP BrowserAccessibilityWin::get_appName(BSTR* app_name) { // GetProduct() returns a string like "Chrome/aa.bb.cc.dd", split out // the part before the "/". - std::vector<std::string> product_components = base::SplitString( - GetContentClient()->GetProduct(), "/", - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> product_components; + base::SplitString(GetContentClient()->GetProduct(), '/', &product_components); DCHECK_EQ(2U, product_components.size()); if (product_components.size() != 2) return E_FAIL; @@ -989,9 +988,8 @@ STDMETHODIMP BrowserAccessibilityWin::get_appVersion(BSTR* app_version) { // GetProduct() returns a string like "Chrome/aa.bb.cc.dd", split out // the part after the "/". - std::vector<std::string> product_components = base::SplitString( - GetContentClient()->GetProduct(), "/", - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> product_components; + base::SplitString(GetContentClient()->GetProduct(), '/', &product_components); DCHECK_EQ(2U, product_components.size()); if (product_components.size() != 2) return E_FAIL; diff --git a/content/browser/accessibility/dump_accessibility_browsertest_base.cc b/content/browser/accessibility/dump_accessibility_browsertest_base.cc index 60c5af6..f86f5d4 100644 --- a/content/browser/accessibility/dump_accessibility_browsertest_base.cc +++ b/content/browser/accessibility/dump_accessibility_browsertest_base.cc @@ -89,9 +89,12 @@ void DumpAccessibilityTestBase::ParseHtmlForExtraDirectives( const std::string& test_html, std::vector<Filter>* filters, std::string* wait_for) { - for (const std::string& line : - base::SplitString(test_html, "\n", base::TRIM_WHITESPACE, - base::SPLIT_WANT_ALL)) { + std::vector<std::string> lines; + base::SplitString(test_html, '\n', &lines); + for (std::vector<std::string>::const_iterator iter = lines.begin(); + iter != lines.end(); + ++iter) { + const std::string& line = *iter; const std::string& allow_empty_str = AccessibilityTreeFormatter::GetAllowEmptyString(); const std::string& allow_str = diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index 1a39c1f..70f474c 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc @@ -323,10 +323,12 @@ MSVC_ENABLE_OPTIMIZE(); // specified on the command-line. Ownership is passed to the caller. base::win::MemoryPressureMonitor* CreateWinMemoryPressureMonitor( const base::CommandLine& parsed_command_line) { - std::vector<std::string> thresholds = base::SplitString( + std::vector<std::string> thresholds; + base::SplitString( parsed_command_line.GetSwitchValueASCII( switches::kMemoryPressureThresholdsMb), - ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + ',', + &thresholds); int moderate_threshold_mb = 0; int critical_threshold_mb = 0; diff --git a/content/browser/download/file_metadata_unittest_linux.cc b/content/browser/download/file_metadata_unittest_linux.cc index c20e573..d3a6ea4 100644 --- a/content/browser/download/file_metadata_unittest_linux.cc +++ b/content/browser/download/file_metadata_unittest_linux.cc @@ -82,9 +82,8 @@ class FileMetadataLinuxTest : public testing::Test { if (len <= static_cast<ssize_t>(0)) return; char* buffer = new char[len]; len = listxattr(test_file().value().c_str(), buffer, len); - *attr_names = base::SplitString(string(buffer, len), std::string(1, '\0'), - base::TRIM_WHITESPACE, - base::SPLIT_WANT_ALL); + attr_names->clear(); + base::SplitString(string(buffer, len), '\0', attr_names); delete[] buffer; } diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index 6ba9c77..f05c253 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc @@ -1217,8 +1217,8 @@ base::FilePath SavePackage::GetSuggestedNameForSaveAs( if (title_ == net::FormatUrl(page_url_, accept_langs)) { std::string url_path; if (!page_url_.SchemeIs(url::kDataScheme)) { - std::vector<std::string> url_parts = base::SplitString( - page_url_.path(), "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> url_parts; + base::SplitString(page_url_.path(), '/', &url_parts); if (!url_parts.empty()) { for (int i = static_cast<int>(url_parts.size()) - 1; i >= 0; --i) { url_path = url_parts[i]; diff --git a/content/browser/loader/resource_dispatcher_host_unittest.cc b/content/browser/loader/resource_dispatcher_host_unittest.cc index 80d78c5..ef90e30 100644 --- a/content/browser/loader/resource_dispatcher_host_unittest.cc +++ b/content/browser/loader/resource_dispatcher_host_unittest.cc @@ -478,8 +478,8 @@ class URLRequestBigJob : public net::URLRequestSimpleJob { // big-job:substring,N static bool ParseURL(const GURL& url, std::string* text, int* count) { - std::vector<std::string> parts = base::SplitString( - url.path(), ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> parts; + base::SplitString(url.path(), ',', &parts); if (parts.size() != 2) return false; @@ -514,8 +514,8 @@ class URLRequestLoadInfoJob : public net::URLRequestJob { // big-job:substring,N static bool ParseURL(const GURL& url, std::string* text, int* count) { - std::vector<std::string> parts = base::SplitString( - url.path(), ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> parts; + base::SplitString(url.path(), ',', &parts); if (parts.size() != 2) return false; diff --git a/content/browser/service_worker/service_worker_browsertest.cc b/content/browser/service_worker/service_worker_browsertest.cc index ca2d440..ca70f77 100644 --- a/content/browser/service_worker/service_worker_browsertest.cc +++ b/content/browser/service_worker/service_worker_browsertest.cc @@ -1154,9 +1154,8 @@ IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest, SyncEventInterface) { // Console output is a pipe-delimited string, as: // <event prototype>|<typeof waitUntil> - std::vector<base::string16> event_properties = - base::SplitString(console_output, base::string16(1, '|'), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<base::string16> event_properties; + base::SplitString(console_output, '|', &event_properties); const base::string16::size_type num_properties = 2; const base::string16 event_type = base::ASCIIToUTF16("SyncEvent"); diff --git a/content/browser/service_worker/service_worker_database.cc b/content/browser/service_worker/service_worker_database.cc index b79894e..ddfcb74 100644 --- a/content/browser/service_worker/service_worker_database.cc +++ b/content/browser/service_worker/service_worker_database.cc @@ -1214,9 +1214,8 @@ ServiceWorkerDatabase::UpgradeDatabaseSchemaFromV1ToV2() { if (!RemovePrefix(itr->key().ToString(), kRegKeyPrefix, &key)) break; - std::vector<std::string> parts = - base::SplitString(key, std::string(1, kKeySeparator), - base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> parts; + base::SplitStringDontTrim(key, kKeySeparator, &parts); if (parts.size() != 2) { status = STATUS_ERROR_CORRUPTED; HandleReadResult(FROM_HERE, status); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 92912b0..287d016 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -2475,11 +2475,11 @@ void WebContentsImpl::SaveFrameWithHeaders(const GURL& url, if (headers.empty()) { params->set_prefer_cache(true); } else { - for (const base::StringPiece& key_value : - base::SplitStringPiece( - headers, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { - std::vector<std::string> pair = base::SplitString( - key_value, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> key_value_list; + base::SplitString(headers, '\n', &key_value_list); + for (const auto& key_value : key_value_list) { + std::vector<std::string> pair; + base::SplitString(key_value, ':', &pair); DCHECK_EQ(2ul, pair.size()); params->add_request_header(pair[0], pair[1]); } diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc index 1763599..25c6b0e 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc @@ -209,18 +209,22 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs( // Enable explicitly enabled features, and then disable explicitly disabled // ones. if (command_line.HasSwitch(switches::kEnableBlinkFeatures)) { - std::vector<std::string> enabled_features = base::SplitString( - command_line.GetSwitchValueASCII(switches::kEnableBlinkFeatures), - ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); - for (const std::string& feature : enabled_features) + std::vector<std::string> enabled_features; + base::SplitString( + command_line.GetSwitchValueASCII(switches::kEnableBlinkFeatures), ',', + &enabled_features); + for (const std::string& feature : enabled_features) { WebRuntimeFeatures::enableFeatureFromString(feature, true); + } } if (command_line.HasSwitch(switches::kDisableBlinkFeatures)) { - std::vector<std::string> disabled_features = base::SplitString( - command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures), - ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); - for (const std::string& feature : disabled_features) + std::vector<std::string> disabled_features; + base::SplitString( + command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures), ',', + &disabled_features); + for (const std::string& feature : disabled_features) { WebRuntimeFeatures::enableFeatureFromString(feature, false); + } } } diff --git a/content/common/gpu/media/jpeg_decode_accelerator_unittest.cc b/content/common/gpu/media/jpeg_decode_accelerator_unittest.cc index f851a73..5e7caa2 100644 --- a/content/common/gpu/media/jpeg_decode_accelerator_unittest.cc +++ b/content/common/gpu/media/jpeg_decode_accelerator_unittest.cc @@ -375,9 +375,8 @@ void JpegDecodeAcceleratorTestEnvironment::SetUp() { media::PIXEL_FORMAT_I420, image_data_invalid_->visible_size); // |user_jpeg_filenames_| may include many files and use ';' as delimiter. - std::vector<base::FilePath::StringType> filenames = base::SplitString( - user_jpeg_filenames_, base::FilePath::StringType(1, ';'), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<base::FilePath::StringType> filenames; + base::SplitString(user_jpeg_filenames_, ';', &filenames); for (const auto& filename : filenames) { base::FilePath input_file = media::GetTestDataFilePath(filename); TestImageFile* image_data = new TestImageFile(filename); diff --git a/content/common/gpu/media/video_decode_accelerator_unittest.cc b/content/common/gpu/media/video_decode_accelerator_unittest.cc index 0605fb0..04978bc 100644 --- a/content/common/gpu/media/video_decode_accelerator_unittest.cc +++ b/content/common/gpu/media/video_decode_accelerator_unittest.cc @@ -180,23 +180,23 @@ void ReadGoldenThumbnailMD5s(const TestVideoFile* video_file, filepath = filepath.AddExtension(FILE_PATH_LITERAL(".md5")); std::string all_md5s; base::ReadFileToString(filepath, &all_md5s); - *md5_strings = base::SplitString( - all_md5s, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + base::SplitString(all_md5s, '\n', md5_strings); // Check these are legitimate MD5s. - for (const std::string& md5_string : *md5_strings) { + for (std::vector<std::string>::iterator md5_string = md5_strings->begin(); + md5_string != md5_strings->end(); ++md5_string) { // Ignore the empty string added by SplitString - if (!md5_string.length()) + if (!md5_string->length()) continue; // Ignore comments - if (md5_string.at(0) == '#') + if (md5_string->at(0) == '#') continue; - CHECK_EQ(static_cast<int>(md5_string.length()), - kMD5StringLength) << md5_string; - bool hex_only = std::count_if(md5_string.begin(), - md5_string.end(), isxdigit) == + CHECK_EQ(static_cast<int>(md5_string->length()), + kMD5StringLength) << *md5_string; + bool hex_only = std::count_if(md5_string->begin(), + md5_string->end(), isxdigit) == kMD5StringLength; - CHECK(hex_only) << md5_string; + CHECK(hex_only) << *md5_string; } CHECK_GE(md5_strings->size(), 1U) << " MD5 checksum file (" << filepath.MaybeAsASCII() @@ -1061,14 +1061,12 @@ void VideoDecodeAcceleratorTest::TearDown() { void VideoDecodeAcceleratorTest::ParseAndReadTestVideoData( base::FilePath::StringType data, std::vector<TestVideoFile*>* test_video_files) { - std::vector<base::FilePath::StringType> entries = base::SplitString( - data, base::FilePath::StringType(1, ';'), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<base::FilePath::StringType> entries; + base::SplitString(data, ';', &entries); CHECK_GE(entries.size(), 1U) << data; for (size_t index = 0; index < entries.size(); ++index) { - std::vector<base::FilePath::StringType> fields = base::SplitString( - entries[index], base::FilePath::StringType(1, ':'), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<base::FilePath::StringType> fields; + base::SplitString(entries[index], ':', &fields); CHECK_GE(fields.size(), 1U) << entries[index]; CHECK_LE(fields.size(), 8U) << entries[index]; TestVideoFile* video_file = new TestVideoFile(fields[0]); diff --git a/content/common/gpu/media/video_encode_accelerator_unittest.cc b/content/common/gpu/media/video_encode_accelerator_unittest.cc index 9c05514..0e1e863 100644 --- a/content/common/gpu/media/video_encode_accelerator_unittest.cc +++ b/content/common/gpu/media/video_encode_accelerator_unittest.cc @@ -324,16 +324,14 @@ static void CreateAlignedInputStreamFile(const gfx::Size& coded_size, static void ParseAndReadTestStreamData(const base::FilePath::StringType& data, ScopedVector<TestStream>* test_streams) { // Split the string to individual test stream data. - std::vector<base::FilePath::StringType> test_streams_data = base::SplitString( - data, base::FilePath::StringType(1, ';'), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<base::FilePath::StringType> test_streams_data; + base::SplitString(data, ';', &test_streams_data); CHECK_GE(test_streams_data.size(), 1U) << data; // Parse each test stream data and read the input file. for (size_t index = 0; index < test_streams_data.size(); ++index) { - std::vector<base::FilePath::StringType> fields = base::SplitString( - test_streams_data[index], base::FilePath::StringType(1, ':'), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<base::FilePath::StringType> fields; + base::SplitString(test_streams_data[index], ':', &fields); CHECK_GE(fields.size(), 4U) << data; CHECK_LE(fields.size(), 9U) << data; TestStream* test_stream = new TestStream(); diff --git a/content/common/pepper_plugin_list.cc b/content/common/pepper_plugin_list.cc index 02fbaee..704c819 100644 --- a/content/common/pepper_plugin_list.cc +++ b/content/common/pepper_plugin_list.cc @@ -52,8 +52,8 @@ void ComputePluginsFromCommandLine(std::vector<PepperPluginInfo>* plugins) { // <file-path> + // ["#" + <name> + ["#" + <description> + ["#" + <version>]]] + // *1( LWS + ";" + LWS + <mime-type> ) - std::vector<std::string> modules = base::SplitString( - value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> modules; + base::SplitString(value, ',', &modules); size_t plugins_to_register = modules.size(); if (plugins_to_register > kMaxPluginsToRegisterFromCommandLine) { @@ -64,15 +64,15 @@ void ComputePluginsFromCommandLine(std::vector<PepperPluginInfo>* plugins) { } for (size_t i = 0; i < plugins_to_register; ++i) { - std::vector<std::string> parts = base::SplitString( - modules[i], ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> parts; + base::SplitString(modules[i], ';', &parts); if (parts.size() < 2) { DVLOG(1) << "Required mime-type not found"; continue; } - std::vector<std::string> name_parts = base::SplitString( - parts[0], "#", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> name_parts; + base::SplitString(parts[0], '#', &name_parts); PepperPluginInfo plugin; plugin.is_out_of_process = out_of_process; diff --git a/content/common/plugin_list.cc b/content/common/plugin_list.cc index 1cc8fa5..7e8d1c2 100644 --- a/content/common/plugin_list.cc +++ b/content/common/plugin_list.cc @@ -130,13 +130,11 @@ bool PluginList::ParseMimeTypes( const std::string& file_extensions_str, const base::string16& mime_type_descriptions_str, std::vector<WebPluginMimeType>* parsed_mime_types) { - std::vector<std::string> mime_types = base::SplitString( - mime_types_str, "|", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); - std::vector<std::string> file_extensions = base::SplitString( - file_extensions_str, "|", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); - std::vector<base::string16> descriptions = base::SplitString( - mime_type_descriptions_str, base::string16(1, '|'), base::TRIM_WHITESPACE, - base::SPLIT_WANT_ALL); + std::vector<std::string> mime_types, file_extensions; + std::vector<base::string16> descriptions; + base::SplitString(mime_types_str, '|', &mime_types); + base::SplitString(file_extensions_str, '|', &file_extensions); + base::SplitString(mime_type_descriptions_str, '|', &descriptions); parsed_mime_types->clear(); @@ -146,10 +144,8 @@ bool PluginList::ParseMimeTypes( for (size_t i = 0; i < mime_types.size(); ++i) { WebPluginMimeType mime_type; mime_type.mime_type = base::StringToLowerASCII(mime_types[i]); - if (file_extensions.size() > i) { - mime_type.file_extensions = base::SplitString( - file_extensions[i], ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); - } + if (file_extensions.size() > i) + base::SplitString(file_extensions[i], ',', &mime_type.file_extensions); if (descriptions.size() > i) { mime_type.description = descriptions[i]; diff --git a/content/common/plugin_list_win.cc b/content/common/plugin_list_win.cc index 98694a2..6c95a0d 100644 --- a/content/common/plugin_list_win.cc +++ b/content/common/plugin_list_win.cc @@ -237,15 +237,12 @@ bool HaveSharedMimeType(const WebPluginInfo& plugin1, // Compares Windows style version strings (i.e. 1,2,3,4). Returns true if b's // version is newer than a's, or false if it's equal or older. bool IsNewerVersion(const base::string16& a, const base::string16& b) { - std::vector<base::string16> a_ver = base::SplitString( - a, base::string16(1, ','), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); - std::vector<base::string16> b_ver = base::SplitString( - b, base::string16(1, ','), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<base::string16> a_ver, b_ver; + base::SplitString(a, ',', &a_ver); + base::SplitString(b, ',', &b_ver); if (a_ver.size() == 1 && b_ver.size() == 1) { - a_ver = base::SplitString( - a, base::string16(1, '.'), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); - b_ver = base::SplitString( - b, base::string16(1, '.'), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + base::SplitString(a, '.', &a_ver); + base::SplitString(b, '.', &b_ver); } if (a_ver.size() != b_ver.size()) return false; @@ -445,9 +442,8 @@ bool PluginList::ShouldLoadPluginUsingPluginList( // We only work with newer versions of the Java plugin which use NPAPI only // and don't depend on XPCOM. if (filename == kJavaPlugin1 || filename == kJavaPlugin2) { - std::vector<base::FilePath::StringType> ver = base::SplitString( - info.version, base::FilePath::StringType(1, '.'), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<base::FilePath::StringType> ver; + base::SplitString(info.version, '.', &ver); int major, minor, update; if (ver.size() == 4 && base::StringToInt(ver[0], &major) && diff --git a/content/public/browser/desktop_media_id.cc b/content/public/browser/desktop_media_id.cc index 74fbb3a..1802a4d 100644 --- a/content/public/browser/desktop_media_id.cc +++ b/content/public/browser/desktop_media_id.cc @@ -97,8 +97,8 @@ DesktopMediaID::DesktopMediaID() = default; // static DesktopMediaID DesktopMediaID::Parse(const std::string& str) { - std::vector<std::string> parts = base::SplitString( - str, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> parts; + base::SplitString(str, ':', &parts); #if defined(USE_AURA) if (parts.size() != 3) diff --git a/content/public/common/webplugininfo.cc b/content/public/common/webplugininfo.cc index d12dfd7..b6fedb9 100644 --- a/content/public/common/webplugininfo.cc +++ b/content/public/common/webplugininfo.cc @@ -83,8 +83,8 @@ void WebPluginInfo::CreateVersionFromString( // Remove leading zeros from each of the version components. std::string no_leading_zeros_version; - std::vector<std::string> numbers = base::SplitString( - version, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> numbers; + base::SplitString(version, '.', &numbers); for (size_t i = 0; i < numbers.size(); ++i) { size_t n = numbers[i].size(); size_t j = 0; diff --git a/content/renderer/manifest/manifest_parser.cc b/content/renderer/manifest/manifest_parser.cc index 780cf91..6b021d2 100644 --- a/content/renderer/manifest/manifest_parser.cc +++ b/content/renderer/manifest/manifest_parser.cc @@ -48,9 +48,8 @@ std::vector<gfx::Size> ParseIconSizesHTML(const base::string16& sizes_str16) { std::vector<gfx::Size> sizes; std::string sizes_str = base::StringToLowerASCII(base::UTF16ToUTF8(sizes_str16)); - std::vector<std::string> sizes_str_list = base::SplitString( - sizes_str, base::kWhitespaceASCII, base::KEEP_WHITESPACE, - base::SPLIT_WANT_NONEMPTY); + std::vector<std::string> sizes_str_list; + base::SplitStringAlongWhitespace(sizes_str, &sizes_str_list); for (size_t i = 0; i < sizes_str_list.size(); ++i) { std::string& size_str = sizes_str_list[i]; @@ -60,8 +59,8 @@ std::vector<gfx::Size> ParseIconSizesHTML(const base::string16& sizes_str16) { } // It is expected that [0] => width and [1] => height after the split. - std::vector<std::string> size_list = base::SplitString( - size_str, "x", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> size_list; + base::SplitStringDontTrim(size_str, L'x', &size_list); if (size_list.size() != 2) continue; if (!IsValidIconWidthOrHeight(size_list[0]) || diff --git a/content/renderer/media/webrtc/stun_field_trial.cc b/content/renderer/media/webrtc/stun_field_trial.cc index 41be358..2d155a4 100644 --- a/content/renderer/media/webrtc/stun_field_trial.cc +++ b/content/renderer/media/webrtc/stun_field_trial.cc @@ -133,8 +133,8 @@ bool ParseStunProbeParameters(const std::string& params, int* interval_ms, int* shared_socket_mode, std::vector<rtc::SocketAddress>* servers) { - std::vector<std::string> stun_params = base::SplitString( - params, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> stun_params; + base::SplitString(params, '/', &stun_params); if (stun_params.size() < 4) { DLOG(ERROR) << "Not enough parameters specified in StartStunProbeTrial"; diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 29f4d4f..eca03fa 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -600,9 +600,10 @@ void ApplyBlinkSettings(const base::CommandLine& command_line, if (!command_line.HasSwitch(switches::kBlinkSettings)) return; - std::vector<std::string> blink_settings = base::SplitString( - command_line.GetSwitchValueASCII(switches::kBlinkSettings), - ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> blink_settings; + base::SplitString( + command_line.GetSwitchValueASCII(switches::kBlinkSettings), ',', + &blink_settings); for (const std::string& setting : blink_settings) { size_t pos = setting.find('='); settings->setFromStrings( diff --git a/content/shell/renderer/layout_test/blink_test_helpers.cc b/content/shell/renderer/layout_test/blink_test_helpers.cc index 1cd3e2f..6719010 100644 --- a/content/shell/renderer/layout_test/blink_test_helpers.cc +++ b/content/shell/renderer/layout_test/blink_test_helpers.cc @@ -126,9 +126,10 @@ std::vector<std::string> GetSideloadFontFiles() { const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kRegisterFontFiles)) { - files = base::SplitString( + base::SplitString( command_line.GetSwitchValueASCII(switches::kRegisterFontFiles), - ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + ';', + &files); } return files; } diff --git a/extensions/browser/api/networking_private/networking_private_linux.cc b/extensions/browser/api/networking_private/networking_private_linux.cc index bd07dc5..1bdb116 100644 --- a/extensions/browser/api/networking_private/networking_private_linux.cc +++ b/extensions/browser/api/networking_private/networking_private_linux.cc @@ -51,8 +51,10 @@ bool ParseNetworkGuid(const std::string& guid, std::string* device_path, std::string* access_point_path, std::string* ssid) { - std::vector<std::string> guid_parts = - base::SplitString(guid, "|", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> guid_parts; + + base::SplitString(guid, '|', &guid_parts); + if (guid_parts.size() != 3) { return false; } diff --git a/extensions/common/csp_validator.cc b/extensions/common/csp_validator.cc index d19b983..1fe2217 100644 --- a/extensions/common/csp_validator.cc +++ b/extensions/common/csp_validator.cc @@ -240,8 +240,8 @@ std::string SanitizeContentSecurityPolicy( int options, std::vector<InstallWarning>* warnings) { // See http://www.w3.org/TR/CSP/#parse-a-csp-policy for parsing algorithm. - std::vector<std::string> directives = base::SplitString( - policy, ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> directives; + base::SplitString(policy, ';', &directives); DirectiveStatus default_src_status(kDefaultSrc); DirectiveStatus script_src_status(kScriptSrc); @@ -307,9 +307,13 @@ std::string SanitizeContentSecurityPolicy( bool ContentSecurityPolicyIsSandboxed( const std::string& policy, Manifest::Type type) { // See http://www.w3.org/TR/CSP/#parse-a-csp-policy for parsing algorithm. + std::vector<std::string> directives; + base::SplitString(policy, ';', &directives); + bool seen_sandbox = false; - for (const std::string& input : base::SplitString( - policy, ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { + + for (size_t i = 0; i < directives.size(); ++i) { + std::string& input = directives[i]; base::StringTokenizer tokenizer(input, " \t\r\n"); if (!tokenizer.GetNext()) continue; diff --git a/extensions/common/features/base_feature_provider.cc b/extensions/common/features/base_feature_provider.cc index cae08d6..472e1f55 100644 --- a/extensions/common/features/base_feature_provider.cc +++ b/extensions/common/features/base_feature_provider.cc @@ -52,8 +52,8 @@ BaseFeatureProvider::BaseFeatureProvider(const base::DictionaryValue& root, if (iter.value().GetType() == base::Value::TYPE_DICTIONARY) { linked_ptr<SimpleFeature> feature((*factory_)()); - std::vector<std::string> split = base::SplitString( - iter.key(), ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> split; + base::SplitString(iter.key(), '.', &split); // Push parent features on the stack, starting with the current feature. // If one of the features has "noparent" set, stop pushing features on @@ -171,8 +171,8 @@ Feature* BaseFeatureProvider::GetParent(Feature* feature) const { if (feature->no_parent()) return nullptr; - std::vector<std::string> split = base::SplitString( - feature->name(), ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> split; + base::SplitString(feature->name(), '.', &split); if (split.size() < 2) return nullptr; split.pop_back(); diff --git a/extensions/common/manifest.cc b/extensions/common/manifest.cc index c552de7..f072488 100644 --- a/extensions/common/manifest.cc +++ b/extensions/common/manifest.cc @@ -240,10 +240,11 @@ int Manifest::GetManifestVersion() const { } bool Manifest::CanAccessPath(const std::string& path) const { + std::vector<std::string> components; + base::SplitString(path, '.', &components); std::string key; - for (const base::StringPiece& component : base::SplitStringPiece( - path, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { - component.AppendToString(&key); + for (size_t i = 0; i < components.size(); ++i) { + key += components[i]; if (!CanAccessKey(key)) return false; key += '.'; diff --git a/extensions/common/permissions/socket_permission_data.cc b/extensions/common/permissions/socket_permission_data.cc index f22f14a..a01c20f 100644 --- a/extensions/common/permissions/socket_permission_data.cc +++ b/extensions/common/permissions/socket_permission_data.cc @@ -124,9 +124,8 @@ SocketPermissionEntry& SocketPermissionData::entry() { bool SocketPermissionData::Parse(const std::string& permission) { Reset(); - std::vector<std::string> tokens = - base::SplitString(permission, std::string(1, kColon), - base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> tokens; + base::SplitStringDontTrim(permission, kColon, &tokens); if (tokens.empty()) return false; diff --git a/extensions/common/permissions/socket_permission_entry.cc b/extensions/common/permissions/socket_permission_entry.cc index 86c61de..8b2d355 100644 --- a/extensions/common/permissions/socket_permission_entry.cc +++ b/extensions/common/permissions/socket_permission_entry.cc @@ -128,9 +128,8 @@ bool SocketPermissionEntry::ParseHostPattern( SocketPermissionRequest::OperationType type, const std::string& pattern, SocketPermissionEntry* entry) { - std::vector<std::string> tokens = - base::SplitString(pattern, std::string(1, kColon), base::KEEP_WHITESPACE, - base::SPLIT_WANT_ALL); + std::vector<std::string> tokens; + base::SplitStringDontTrim(pattern, kColon, &tokens); return ParseHostPattern(type, tokens, entry); } @@ -169,9 +168,8 @@ bool SocketPermissionEntry::ParseHostPattern( result.pattern_.host = base::StringToLowerASCII(result.pattern_.host); // The first component can optionally be '*' to match all subdomains. - std::vector<std::string> host_components = - base::SplitString(result.pattern_.host, std::string(1, kDot), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> host_components; + base::SplitString(result.pattern_.host, kDot, &host_components); DCHECK(!host_components.empty()); if (host_components[0] == kWildcard || host_components[0].empty()) { diff --git a/extensions/common/url_pattern.cc b/extensions/common/url_pattern.cc index b91d438..502c459 100644 --- a/extensions/common/url_pattern.cc +++ b/extensions/common/url_pattern.cc @@ -237,12 +237,11 @@ URLPattern::ParseResult URLPattern::Parse(const std::string& pattern) { host_ = pattern.substr(host_start_pos, host_end_pos - host_start_pos); // The first component can optionally be '*' to match all subdomains. - std::vector<std::string> host_components = base::SplitString( - host_, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> host_components; + base::SplitString(host_, '.', &host_components); // Could be empty if the host only consists of whitespace characters. - if (host_components.empty() || - (host_components.size() == 1 && host_components[0].empty())) + if (host_components.empty()) return PARSE_ERROR_EMPTY_HOST; if (host_components[0] == "*") { diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc index 94bfb78..997185e 100644 --- a/extensions/renderer/dispatcher.cc +++ b/extensions/renderer/dispatcher.cc @@ -1347,8 +1347,8 @@ v8::Local<v8::Object> Dispatcher::GetOrCreateBindObjectIfAvailable( const std::string& api_name, std::string* bind_name, ScriptContext* context) { - std::vector<std::string> split = base::SplitString( - api_name, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> split; + base::SplitString(api_name, '.', &split); v8::Local<v8::Object> bind_object; diff --git a/google_apis/drive/test_util.cc b/google_apis/drive/test_util.cc index e77aedf..ae96409 100644 --- a/google_apis/drive/test_util.cc +++ b/google_apis/drive/test_util.cc @@ -133,16 +133,17 @@ bool ParseContentRangeHeader(const std::string& value, if (!RemovePrefix(value, "bytes ", &remaining)) return false; - std::vector<base::StringPiece> parts = base::SplitStringPiece( - remaining, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> parts; + base::SplitString(remaining, '/', &parts); if (parts.size() != 2U) return false; + const std::string range = parts[0]; if (!base::StringToInt64(parts[1], length)) return false; - parts = base::SplitStringPiece(parts[0], "-", base::TRIM_WHITESPACE, - base::SPLIT_WANT_ALL); + parts.clear(); + base::SplitString(range, '-', &parts); if (parts.size() != 2U) return false; diff --git a/google_apis/gaia/fake_gaia.cc b/google_apis/gaia/fake_gaia.cc index d24158c..6749393 100644 --- a/google_apis/gaia/fake_gaia.cc +++ b/google_apis/gaia/fake_gaia.cc @@ -71,13 +71,17 @@ typedef std::map<std::string, std::string> CookieMap; // Parses cookie name-value map our of |request|. CookieMap GetRequestCookies(const HttpRequest& request) { CookieMap result; - auto iter = request.headers.find("Cookie"); + std::map<std::string, std::string>::const_iterator iter = + request.headers.find("Cookie"); if (iter != request.headers.end()) { - for (const std::string& cookie_line : - base::SplitString(iter->second, " ", base::TRIM_WHITESPACE, - base::SPLIT_WANT_ALL)) { - std::vector<std::string> name_value = base::SplitString( - cookie_line, "=", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> cookie_nv_pairs; + base::SplitString(iter->second, ' ', &cookie_nv_pairs); + for(std::vector<std::string>::const_iterator cookie_line = + cookie_nv_pairs.begin(); + cookie_line != cookie_nv_pairs.end(); + ++cookie_line) { + std::vector<std::string> name_value; + base::SplitString(*cookie_line, '=', &name_value); if (name_value.size() != 2) continue; @@ -437,8 +441,8 @@ const FakeGaia::AccessTokenInfo* FakeGaia::FindAccessTokenInfo( if (auth_token.empty() || client_id.empty()) return NULL; - std::vector<std::string> scope_list = base::SplitString( - scope_string, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> scope_list; + base::SplitString(scope_string, ' ', &scope_list); ScopeSet scopes(scope_list.begin(), scope_list.end()); for (AccessTokenInfoMap::const_iterator entry( diff --git a/google_apis/gaia/gaia_auth_fetcher.cc b/google_apis/gaia/gaia_auth_fetcher.cc index 086414f..04ebd6e 100644 --- a/google_apis/gaia/gaia_auth_fetcher.cc +++ b/google_apis/gaia/gaia_auth_fetcher.cc @@ -508,8 +508,8 @@ bool GaiaAuthFetcher::ParseClientLoginToOAuth2Response( // static bool GaiaAuthFetcher::ParseClientLoginToOAuth2Cookie(const std::string& cookie, std::string* auth_code) { - std::vector<std::string> parts = base::SplitString( - cookie, ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> parts; + base::SplitString(cookie, ';', &parts); // Per documentation, the cookie should have Secure and HttpOnly. if (!CookiePartsContains(parts, kClientLoginToOAuth2CookiePartSecure) || !CookiePartsContains(parts, kClientLoginToOAuth2CookiePartHttpOnly)) { diff --git a/google_apis/gaia/gaia_auth_util.cc b/google_apis/gaia/gaia_auth_util.cc index cc5e17c..5464da6 100644 --- a/google_apis/gaia/gaia_auth_util.cc +++ b/google_apis/gaia/gaia_auth_util.cc @@ -21,8 +21,9 @@ const char kGooglemailDomain[] = "googlemail.com"; std::string CanonicalizeEmailImpl(const std::string& email_address, bool change_googlemail_to_gmail) { - std::vector<std::string> parts = base::SplitString( - email_address, "@", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> parts; + char at = '@'; + base::SplitString(email_address, at, &parts); if (parts.size() != 2U) { NOTREACHED() << "expecting exactly one @, but got " << (parts.empty() ? 0 : parts.size() - 1) diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc index b8737fc..6f6cf63 100644 --- a/gpu/command_buffer/service/feature_info.cc +++ b/gpu/command_buffer/service/feature_info.cc @@ -83,11 +83,11 @@ class StringSet { void StringToWorkarounds( const std::string& types, FeatureInfo::Workarounds* workarounds) { DCHECK(workarounds); - for (const base::StringPiece& piece : - base::SplitStringPiece( - types, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { + std::vector<std::string> pieces; + base::SplitString(types, ',', &pieces); + for (size_t i = 0; i < pieces.size(); ++i) { int number = 0; - bool succeed = base::StringToInt(piece, &number); + bool succeed = base::StringToInt(pieces[i], &number); DCHECK(succeed); switch (number) { #define GPU_OP(type, name) \ diff --git a/gpu/config/gpu_control_list.cc b/gpu/config/gpu_control_list.cc index 2e44e3d..1fbf0b6 100644 --- a/gpu/config/gpu_control_list.cc +++ b/gpu/config/gpu_control_list.cc @@ -25,9 +25,7 @@ bool ProcessVersionString(const std::string& version_string, char splitter, std::vector<std::string>* version) { DCHECK(version); - *version = base::SplitString( - version_string, std::string(1, splitter), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + base::SplitString(version_string, splitter, version); if (version->size() == 0) return false; // If the splitter is '-', we assume it's a date with format "mm-dd-yyyy"; @@ -1030,8 +1028,8 @@ bool GpuControlList::GpuControlListEntry::GLVersionInfoMismatch( if (gl_version_info_.get() == NULL && gl_type_ == kGLTypeNone) return false; - std::vector<std::string> segments = base::SplitString( - gl_version, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> segments; + base::SplitString(gl_version, ' ', &segments); std::string number; GLType gl_type = kGLTypeNone; if (segments.size() > 2 && diff --git a/gpu/config/gpu_info_collector.cc b/gpu/config/gpu_info_collector.cc index 23da95e..55a2947 100644 --- a/gpu/config/gpu_info_collector.cc +++ b/gpu/config/gpu_info_collector.cc @@ -68,8 +68,8 @@ std::string GetVersionFromString(const std::string& version_string) { sub_string = version_string.substr(begin, end - begin); else sub_string = version_string.substr(begin); - std::vector<std::string> pieces = base::SplitString( - sub_string, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> pieces; + base::SplitString(sub_string, '.', &pieces); if (pieces.size() >= 2) return pieces[0] + "." + pieces[1]; } diff --git a/gpu/config/gpu_info_collector_android.cc b/gpu/config/gpu_info_collector_android.cc index c6d9b19..93da6a9 100644 --- a/gpu/config/gpu_info_collector_android.cc +++ b/gpu/config/gpu_info_collector_android.cc @@ -34,8 +34,8 @@ std::pair<std::string, size_t> GetVersionFromString( sub_string = version_string.substr(begin, end - begin); else sub_string = version_string.substr(begin); - std::vector<std::string> pieces = base::SplitString( - sub_string, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> pieces; + base::SplitString(sub_string, '.', &pieces); if (pieces.size() >= 2) return std::make_pair(pieces[0] + "." + pieces[1], end); else diff --git a/gpu/config/gpu_info_collector_linux.cc b/gpu/config/gpu_info_collector_linux.cc index e93a79c..976aff6 100644 --- a/gpu/config/gpu_info_collector_linux.cc +++ b/gpu/config/gpu_info_collector_linux.cc @@ -247,9 +247,8 @@ CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { std::string gl_version = gpu_info->gl_version; if (base::StartsWith(gl_version, "OpenGL ES", base::CompareCase::SENSITIVE)) gl_version = gl_version.substr(10); - std::vector<std::string> pieces = base::SplitString( - gl_version, base::kWhitespaceASCII, base::KEEP_WHITESPACE, - base::SPLIT_WANT_NONEMPTY); + std::vector<std::string> pieces; + base::SplitStringAlongWhitespace(gl_version, &pieces); // In linux, the gl version string might be in the format of // GLVersion DriverVendor DriverVersion if (pieces.size() < 3) diff --git a/gpu/config/gpu_test_expectations_parser.cc b/gpu/config/gpu_test_expectations_parser.cc index 27a1487..d44e5bb 100644 --- a/gpu/config/gpu_test_expectations_parser.cc +++ b/gpu/config/gpu_test_expectations_parser.cc @@ -187,8 +187,8 @@ bool GPUTestExpectationsParser::LoadTestExpectations(const std::string& data) { entries_.clear(); error_messages_.clear(); - std::vector<std::string> lines = base::SplitString( - data, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> lines; + base::SplitString(data, '\n', &lines); bool rt = true; for (size_t i = 0; i < lines.size(); ++i) { if (!ParseLine(lines[i], i + 1)) @@ -234,9 +234,8 @@ GPUTestExpectationsParser::GetErrorMessages() const { bool GPUTestExpectationsParser::ParseConfig( const std::string& config_data, GPUTestConfig* config) { DCHECK(config); - std::vector<std::string> tokens = base::SplitString( - config_data, base::kWhitespaceASCII, base::KEEP_WHITESPACE, - base::SPLIT_WANT_NONEMPTY); + std::vector<std::string> tokens; + base::SplitStringAlongWhitespace(config_data, &tokens); for (size_t i = 0; i < tokens.size(); ++i) { Token token = ParseToken(tokens[i]); @@ -285,9 +284,8 @@ bool GPUTestExpectationsParser::ParseConfig( bool GPUTestExpectationsParser::ParseLine( const std::string& line_data, size_t line_number) { - std::vector<std::string> tokens = base::SplitString( - line_data, base::kWhitespaceASCII, base::KEEP_WHITESPACE, - base::SPLIT_WANT_NONEMPTY); + std::vector<std::string> tokens; + base::SplitStringAlongWhitespace(line_data, &tokens); int32 stage = kLineParserBegin; GPUTestExpectationEntry entry; entry.line_number = line_number; diff --git a/gpu/config/gpu_util.cc b/gpu/config/gpu_util.cc index 80a99fb..5d67988 100644 --- a/gpu/config/gpu_util.cc +++ b/gpu/config/gpu_util.cc @@ -34,11 +34,11 @@ std::string IntSetToString(const std::set<int>& list) { void StringToIntSet(const std::string& str, std::set<int>* list) { DCHECK(list); - for (const base::StringPiece& piece : - base::SplitStringPiece(str, ",", base::TRIM_WHITESPACE, - base::SPLIT_WANT_ALL)) { + std::vector<std::string> pieces; + base::SplitString(str, ',', &pieces); + for (size_t i = 0; i < pieces.size(); ++i) { int number = 0; - bool succeed = base::StringToInt(piece, &number); + bool succeed = base::StringToInt(pieces[i], &number); DCHECK(succeed); list->insert(number); } diff --git a/media/base/mime_util.cc b/media/base/mime_util.cc index 8e29ca6..00a2c74 100644 --- a/media/base/mime_util.cc +++ b/media/base/mime_util.cc @@ -417,9 +417,9 @@ bool MimeUtil::AreSupportedMediaCodecs( void MimeUtil::ParseCodecString(const std::string& codecs, std::vector<std::string>* codecs_out, bool strip) { - *codecs_out = base::SplitString( - base::TrimString(codecs, "\"", base::TRIM_ALL), - ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); + std::string no_quote_codecs; + base::TrimString(codecs, "\"", &no_quote_codecs); + base::SplitString(no_quote_codecs, ',', codecs_out); if (!strip) return; diff --git a/media/base/mime_util_unittest.cc b/media/base/mime_util_unittest.cc index 199e7cf..d1d6722 100644 --- a/media/base/mime_util_unittest.cc +++ b/media/base/mime_util_unittest.cc @@ -120,7 +120,7 @@ TEST(MimeUtilTest, ParseCodecString) { { "", 0, { } }, { "\"\"", 0, { } }, { "\" \"", 0, { } }, - { ",", 0, { } }, + { ",", 2, { "", "" } }, }; for (size_t i = 0; i < arraysize(tests); ++i) { diff --git a/media/filters/chunk_demuxer_unittest.cc b/media/filters/chunk_demuxer_unittest.cc index 3d99e3d..7cf841a 100644 --- a/media/filters/chunk_demuxer_unittest.cc +++ b/media/filters/chunk_demuxer_unittest.cc @@ -439,8 +439,8 @@ class ChunkDemuxerTest : public ::testing::Test { void ParseBlockDescriptions(int track_number, const std::string block_descriptions, std::vector<BlockInfo>* blocks) { - std::vector<std::string> timestamps = base::SplitString( - block_descriptions, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> timestamps; + base::SplitString(block_descriptions, ' ', ×tamps); for (size_t i = 0; i < timestamps.size(); ++i) { std::string timestamp_str = timestamps[i]; @@ -1059,8 +1059,8 @@ class ChunkDemuxerTest : public ::testing::Test { void CheckExpectedBuffers(DemuxerStream* stream, const std::string& expected) { - std::vector<std::string> timestamps = base::SplitString( - expected, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> timestamps; + base::SplitString(expected, ' ', ×tamps); std::stringstream ss; for (size_t i = 0; i < timestamps.size(); ++i) { // Initialize status to kAborted since it's possible for Read() to return diff --git a/media/filters/frame_processor_unittest.cc b/media/filters/frame_processor_unittest.cc index 3a7f01c..e0bd663 100644 --- a/media/filters/frame_processor_unittest.cc +++ b/media/filters/frame_processor_unittest.cc @@ -99,8 +99,8 @@ class FrameProcessorTest : public testing::TestWithParam<bool> { BufferQueue StringToBufferQueue(const std::string& buffers_to_append, const TrackId track_id, const DemuxerStream::Type type) { - std::vector<std::string> timestamps = base::SplitString( - buffers_to_append, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> timestamps; + base::SplitString(buffers_to_append, ' ', ×tamps); BufferQueue buffers; for (size_t i = 0; i < timestamps.size(); i++) { @@ -112,8 +112,8 @@ class FrameProcessorTest : public testing::TestWithParam<bool> { } // Use custom decode timestamp if included. - std::vector<std::string> buffer_timestamps = base::SplitString( - timestamps[i], "|", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> buffer_timestamps; + base::SplitString(timestamps[i], '|', &buffer_timestamps); if (buffer_timestamps.size() == 1) buffer_timestamps.push_back(buffer_timestamps[0]); CHECK_EQ(2u, buffer_timestamps.size()); @@ -193,8 +193,8 @@ class FrameProcessorTest : public testing::TestWithParam<bool> { // as timestamp_in_ms. void CheckReadsThenReadStalls(ChunkDemuxerStream* stream, const std::string& expected) { - std::vector<std::string> timestamps = base::SplitString( - expected, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> timestamps; + base::SplitString(expected, ' ', ×tamps); std::stringstream ss; for (size_t i = 0; i < timestamps.size(); ++i) { int loop_count = 0; diff --git a/media/filters/source_buffer_stream_unittest.cc b/media/filters/source_buffer_stream_unittest.cc index 3d03ccd..6282135 100644 --- a/media/filters/source_buffer_stream_unittest.cc +++ b/media/filters/source_buffer_stream_unittest.cc @@ -252,8 +252,8 @@ class SourceBufferStreamTest : public testing::Test { } void CheckExpectedBuffers(const std::string& expected) { - std::vector<std::string> timestamps = base::SplitString( - expected, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> timestamps; + base::SplitString(expected, ' ', ×tamps); std::stringstream ss; const SourceBufferStream::Type type = stream_->GetType(); base::TimeDelta active_splice_timestamp = kNoTimestamp(); @@ -484,8 +484,8 @@ class SourceBufferStreamTest : public testing::Test { // id to use for that and subsequent preroll appends is incremented by one. // The config id for non-splice frame appends will not be affected. BufferQueue StringToBufferQueue(const std::string& buffers_to_append) { - std::vector<std::string> timestamps = base::SplitString( - buffers_to_append, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> timestamps; + base::SplitString(buffers_to_append, ' ', ×tamps); CHECK_GT(timestamps.size(), 0u); @@ -549,8 +549,8 @@ class SourceBufferStreamTest : public testing::Test { timestamps[i] = timestamps[i].substr(0, duration_pos); } - std::vector<std::string> buffer_timestamps = base::SplitString( - timestamps[i], "|", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> buffer_timestamps; + base::SplitString(timestamps[i], '|', &buffer_timestamps); if (buffer_timestamps.size() == 1) buffer_timestamps.push_back(buffer_timestamps[0]); diff --git a/media/filters/video_cadence_estimator_unittest.cc b/media/filters/video_cadence_estimator_unittest.cc index 845bb3a..d967004 100644 --- a/media/filters/video_cadence_estimator_unittest.cc +++ b/media/filters/video_cadence_estimator_unittest.cc @@ -25,13 +25,13 @@ static base::TimeDelta Interval(double hertz) { } std::vector<int> CreateCadenceFromString(const std::string& cadence) { + std::vector<std::string> tokens; CHECK_EQ('[', cadence[0]); CHECK_EQ(']', cadence[cadence.length() - 1]); + base::SplitString(cadence.substr(1, cadence.length() - 2), ':', &tokens); std::vector<int> result; - for (const std::string& token : - base::SplitString(cadence.substr(1, cadence.length() - 2), - ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { + for (const auto& token : tokens) { int cadence_value = 0; CHECK(base::StringToInt(token, &cadence_value)) << token; result.push_back(cadence_value); diff --git a/media/formats/mp4/avc_unittest.cc b/media/formats/mp4/avc_unittest.cc index 24f6c1d..e9ec17b 100644 --- a/media/formats/mp4/avc_unittest.cc +++ b/media/formats/mp4/avc_unittest.cc @@ -145,8 +145,8 @@ void StringToAnnexB(const std::string& str, std::vector<uint8>* buffer, size_t start = buffer->size(); std::vector<std::string> subsample_nalus = base::SplitString( - subsample_specs[i], ",", base::KEEP_WHITESPACE, - base::SPLIT_WANT_NONEMPTY); + subsample_specs[i], ",", base::KEEP_WHITESPACE, + base::SPLIT_WANT_NONEMPTY); EXPECT_GT(subsample_nalus.size(), 0u); for (size_t j = 0; j < subsample_nalus.size(); ++j) { WriteStartCodeAndNALUType(buffer, subsample_nalus[j]); diff --git a/media/formats/mp4/track_run_iterator_unittest.cc b/media/formats/mp4/track_run_iterator_unittest.cc index f9dde72..6bfab11 100644 --- a/media/formats/mp4/track_run_iterator_unittest.cc +++ b/media/formats/mp4/track_run_iterator_unittest.cc @@ -146,8 +146,8 @@ class TrackRunIteratorTest : public testing::Test { // ON - SampleDependsOnOthers & IsNonSyncSample // NS - SampleDependsOnNoOthers & IsSyncSample // NN - SampleDependsOnNoOthers & IsNonSyncSample - std::vector<std::string> flags_data = base::SplitString( - sample_info, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> flags_data; + base::SplitString(sample_info, ' ', &flags_data); if (flags_data.size() == 1u) { // Simulates the first_sample_flags_present set scenario, diff --git a/media/renderers/video_renderer_impl_unittest.cc b/media/renderers/video_renderer_impl_unittest.cc index e8602bb..794fb01 100644 --- a/media/renderers/video_renderer_impl_unittest.cc +++ b/media/renderers/video_renderer_impl_unittest.cc @@ -166,17 +166,17 @@ class VideoRendererImplTest // A clip that is four frames long: "0 10 20 30" // A clip that has a decode error: "60 70 error" void QueueFrames(const std::string& str) { - for (const std::string& token : - base::SplitString(str, " ", base::TRIM_WHITESPACE, - base::SPLIT_WANT_ALL)) { - if (token == "abort") { + std::vector<std::string> tokens; + base::SplitString(str, ' ', &tokens); + for (size_t i = 0; i < tokens.size(); ++i) { + if (tokens[i] == "abort") { scoped_refptr<VideoFrame> null_frame; decode_results_.push_back( std::make_pair(VideoDecoder::kAborted, null_frame)); continue; } - if (token == "error") { + if (tokens[i] == "error") { scoped_refptr<VideoFrame> null_frame; decode_results_.push_back( std::make_pair(VideoDecoder::kDecodeError, null_frame)); @@ -184,7 +184,7 @@ class VideoRendererImplTest } int timestamp_in_ms = 0; - if (base::StringToInt(token, ×tamp_in_ms)) { + if (base::StringToInt(tokens[i], ×tamp_in_ms)) { gfx::Size natural_size = TestVideoConfig::NormalCodedSize(); scoped_refptr<VideoFrame> frame = VideoFrame::CreateFrame( PIXEL_FORMAT_YV12, natural_size, gfx::Rect(natural_size), @@ -193,7 +193,7 @@ class VideoRendererImplTest continue; } - CHECK(false) << "Unrecognized decoder buffer token: " << token; + CHECK(false) << "Unrecognized decoder buffer token: " << tokens[i]; } } diff --git a/remoting/protocol/negotiating_host_authenticator.cc b/remoting/protocol/negotiating_host_authenticator.cc index c4dada4..37c7a57e5 100644 --- a/remoting/protocol/negotiating_host_authenticator.cc +++ b/remoting/protocol/negotiating_host_authenticator.cc @@ -99,12 +99,12 @@ void NegotiatingHostAuthenticator::ProcessMessage( // Find the first mutually-supported method in the client's list of // supported-methods. - for (const std::string& method_str : - base::SplitString(supported_methods_attr, - std::string(1, kSupportedMethodsSeparator), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { - AuthenticationMethod list_value = - AuthenticationMethod::FromString(method_str); + std::vector<std::string> supported_methods_strs; + base::SplitString(supported_methods_attr, kSupportedMethodsSeparator, + &supported_methods_strs); + for (std::vector<std::string>::iterator it = supported_methods_strs.begin(); + it != supported_methods_strs.end(); ++it) { + AuthenticationMethod list_value = AuthenticationMethod::FromString(*it); if (list_value.is_valid() && std::find(methods_.begin(), methods_.end(), list_value) != methods_.end()) { diff --git a/ui/aura/bench/bench_main.cc b/ui/aura/bench/bench_main.cc index f3a058a..aa4ea4a 100644 --- a/ui/aura/bench/bench_main.cc +++ b/ui/aura/bench/bench_main.cc @@ -170,8 +170,8 @@ class WebGLBench : public BenchCompositorObserver { int width = 0; int height = 0; if (!webgl_size.empty()) { - std::vector<std::string> split_size = base::SplitString( - webgl_size, "x", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> split_size; + base::SplitString(webgl_size, 'x', &split_size); if (split_size.size() == 2) { width = atoi(split_size[0].c_str()); height = atoi(split_size[1].c_str()); diff --git a/ui/base/ime/input_method_auralinux_unittest.cc b/ui/base/ime/input_method_auralinux_unittest.cc index 2cd1500..5c4afc5 100644 --- a/ui/base/ime/input_method_auralinux_unittest.cc +++ b/ui/base/ime/input_method_auralinux_unittest.cc @@ -87,9 +87,8 @@ class LinuxInputMethodContextForTesting : public LinuxInputMethodContext { } for (const auto& action : actions_) { - std::vector<base::string16> parts = base::SplitString( - action, base::string16(1, ':'), base::TRIM_WHITESPACE, - base::SPLIT_WANT_ALL); + std::vector<base::string16> parts; + base::SplitString(action, L':', &parts); base::char16 id = parts[0][0]; base::string16 param; if (parts.size() > 1) diff --git a/ui/events/devices/x11/touch_factory_x11.cc b/ui/events/devices/x11/touch_factory_x11.cc index 3fa15c8..3229344 100644 --- a/ui/events/devices/x11/touch_factory_x11.cc +++ b/ui/events/devices/x11/touch_factory_x11.cc @@ -62,15 +62,16 @@ void TouchFactory::SetTouchDeviceListFromCommandLine() { switches::kTouchDevices); if (!touch_devices.empty()) { + std::vector<std::string> devs; std::vector<int> device_ids; - for (const base::StringPiece& dev : - base::SplitStringPiece(touch_devices, ",", base::TRIM_WHITESPACE, - base::SPLIT_WANT_ALL)) { - int devid; - if (base::StringToInt(dev, &devid)) + int devid; + base::SplitString(touch_devices, ',', &devs); + for (std::vector<std::string>::iterator iter = devs.begin(); + iter != devs.end(); ++iter) { + if (base::StringToInt(*iter, reinterpret_cast<int*>(&devid))) device_ids.push_back(devid); else - DLOG(WARNING) << "Invalid touch-device id: " << dev.as_string(); + DLOG(WARNING) << "Invalid touch-device id: " << *iter; } ui::TouchFactory::GetInstance()->SetTouchDeviceList(device_ids); } diff --git a/ui/events/ozone/evdev/event_device_test_util.cc b/ui/events/ozone/evdev/event_device_test_util.cc index f9feb04..218d309 100644 --- a/ui/events/ozone/evdev/event_device_test_util.cc +++ b/ui/events/ozone/evdev/event_device_test_util.cc @@ -43,13 +43,13 @@ std::string SerializeBitfield(unsigned long* bitmap, int max) { bool ParseBitfield(const std::string& bitfield, size_t max_bits, std::vector<unsigned long>* out) { - std::vector<std::string> groups = base::SplitString( - bitfield, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> groups; + base::SplitString(bitfield, ' ', &groups); out->resize(EVDEV_BITS_TO_LONGS(max_bits)); // Convert big endian 64-bit groups to little endian EVDEV_LONG_BIT groups. - for (size_t i = 0; i < groups.size(); ++i) { + for (unsigned int i = 0; i < groups.size(); ++i) { int off = groups.size() - 1 - i; uint64_t val; diff --git a/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc b/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc index 1e7ef06..64e0696 100644 --- a/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc +++ b/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc @@ -766,8 +766,8 @@ MatchUSBID::MatchUSBID(const std::string& arg) : MatchCriteria(arg) { LOG(ERROR) << "Invalid USB ID: " << args_[i]; continue; } - std::vector<std::string> tokens = base::SplitString( - args_[i], ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> tokens; + base::SplitString(args_[i], ':', &tokens); vid_patterns_.push_back(base::StringToLowerASCII(tokens[0])); pid_patterns_.push_back(base::StringToLowerASCII(tokens[1])); } diff --git a/ui/gfx/font_fallback_win.cc b/ui/gfx/font_fallback_win.cc index e5771cf..6b9c620 100644 --- a/ui/gfx/font_fallback_win.cc +++ b/ui/gfx/font_fallback_win.cc @@ -180,8 +180,8 @@ namespace internal { void ParseFontLinkEntry(const std::string& entry, std::string* filename, std::string* font_name) { - std::vector<std::string> parts = base::SplitString( - entry, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> parts; + base::SplitString(entry, ',', &parts); filename->clear(); font_name->clear(); if (parts.size() > 0) @@ -199,8 +199,7 @@ void ParseFontFamilyString(const std::string& family, // followed optionally by the font family name and a pair of integer scaling // factors. // TODO(asvitkine): Should we support these scaling factors? - *font_names = base::SplitString( - family, "&", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + base::SplitString(family, '&', font_names); if (!font_names->empty()) { const size_t index = font_names->back().find('('); if (index != std::string::npos) { diff --git a/ui/gfx/font_list.cc b/ui/gfx/font_list.cc index f9b34a6..7bdf903 100644 --- a/ui/gfx/font_list.cc +++ b/ui/gfx/font_list.cc @@ -34,17 +34,15 @@ bool FontList::ParseDescription(const std::string& description, DCHECK(style_out); DCHECK(size_pixels_out); - *families_out = base::SplitString( - description, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + base::SplitString(description, ',', families_out); if (families_out->empty()) return false; for (auto& family : *families_out) base::TrimWhitespaceASCII(family, base::TRIM_ALL, &family); // The last item is "[STYLE1] [STYLE2] [...] SIZE". - std::vector<std::string> styles = base::SplitString( - families_out->back(), base::kWhitespaceASCII, - base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); + std::vector<std::string> styles; + base::SplitStringAlongWhitespace(families_out->back(), &styles); families_out->pop_back(); if (styles.empty()) return false; diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc index bad1262..849f530 100644 --- a/ui/gfx/render_text_unittest.cc +++ b/ui/gfx/render_text_unittest.cc @@ -2313,9 +2313,8 @@ TEST_F(RenderTextTest, Multiline_HorizontalAlignment) { EXPECT_EQ(0, render_text.GetAlignmentOffset(0).x()); EXPECT_EQ(0, render_text.GetAlignmentOffset(1).x()); } else { - std::vector<base::string16> lines = base::SplitString( - base::WideToUTF16(kTestStrings[i].text), - base::string16(1, '\n'), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<base::string16> lines; + base::SplitString(base::WideToUTF16(kTestStrings[i].text), '\n', &lines); ASSERT_EQ(2u, lines.size()); int difference = (lines[0].length() - lines[1].length()) * kGlyphSize; EXPECT_EQ(render_text.GetAlignmentOffset(0).x() + difference, diff --git a/ui/gl/gl_gl_api_implementation.cc b/ui/gl/gl_gl_api_implementation.cc index a59a2c0..2de5c97 100644 --- a/ui/gl/gl_gl_api_implementation.cc +++ b/ui/gl/gl_gl_api_implementation.cc @@ -480,8 +480,7 @@ void RealGLApi::InitializeFilteredExtensions() { FilterGLExtensionList(reinterpret_cast<const char*>( GLApiBase::glGetStringFn(GL_EXTENSIONS)), disabled_exts_); - filtered_exts_ = base::SplitString( - filtered_exts_str_, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + base::SplitString(filtered_exts_str_, ' ', &filtered_exts_); } else { GLint num_extensions = 0; GLApiBase::glGetIntegervFn(GL_NUM_EXTENSIONS, &num_extensions); diff --git a/ui/gl/gl_implementation.cc b/ui/gl/gl_implementation.cc index 66f2282..522386a 100644 --- a/ui/gl/gl_implementation.cc +++ b/ui/gl/gl_implementation.cc @@ -163,8 +163,8 @@ std::string FilterGLExtensionList( if (extensions == NULL) return ""; - std::vector<std::string> extension_vec = base::SplitString( - extensions, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> extension_vec; + base::SplitString(extensions, ' ', &extension_vec); auto is_disabled = [&disabled_extensions](const std::string& ext) { return std::find(disabled_extensions.begin(), disabled_extensions.end(), diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc index 43dafe6..7664520 100644 --- a/ui/views/controls/label.cc +++ b/ui/views/controls/label.cc @@ -496,9 +496,7 @@ std::vector<base::string16> Label::GetLinesForWidth(int width) const { // |width| can be 0 when getting the default text size, in that case // the ideal lines (i.e. broken at newline characters) are wanted. if (width <= 0) { - lines = base::SplitString( - render_text_->GetDisplayText(), base::string16(1, '\n'), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + base::SplitString(render_text_->GetDisplayText(), '\n', &lines); } else { gfx::ElideRectangleText(render_text_->GetDisplayText(), font_list(), width, std::numeric_limits<int>::max(), |