Skip to content

Commit

Permalink
Use base::StringTokenizer::token_piece() when std::string is not needed.
Browse files Browse the repository at this point in the history
base::StringTokenizer::token() creates a new std::string each time. Many
callers do not even need a std::string, so just update them to use
token_piece() instead.

This CL was uploaded by git cl split.

R=ellyjones@chromium.org

Bug: 1199547
Change-Id: I6d17089d3e68268914f4cff963be7055989863e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2832869
Auto-Submit: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#873965}
  • Loading branch information
zetafunction authored and Chromium LUCI CQ committed Apr 19, 2021
1 parent 64c58a9 commit d1b58db
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions components/flags_ui/flags_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,8 @@ std::set<std::string> TokenizeOriginList(const std::string& value) {
base::StringTokenizer tokenizer(input, delimiters);
std::set<std::string> origin_strings;
while (tokenizer.GetNext()) {
const std::string token = tokenizer.token();
if (token.empty()) {
continue;
}
base::StringPiece token = tokenizer.token_piece();
DCHECK(!token.empty());
const GURL url(token);
if (!url.is_valid() ||
(!url.SchemeIsHTTPOrHTTPS() && !url.SchemeIsWSOrWSS())) {
Expand Down

0 comments on commit d1b58db

Please sign in to comment.