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

Unified Diff: chrome/browser/webshare/share_service_impl.cc

Issue 2691193002: Added StringPiece overloads for base::JoinString. (Closed)
Patch Set: Created 3 years, 10 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
« base/strings/string_util.cc ('K') | « base/strings/string_util_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/webshare/share_service_impl.cc
diff --git a/chrome/browser/webshare/share_service_impl.cc b/chrome/browser/webshare/share_service_impl.cc
index 7d2ddc1d20529ceb0aa3eeef01b413a88107a297..be58ec13848dcc2159a7c8f3a0237b09f6b97b95 100644
--- a/chrome/browser/webshare/share_service_impl.cc
+++ b/chrome/browser/webshare/share_service_impl.cc
@@ -26,23 +26,6 @@ bool IsIdentifier(char c) {
return base::IsAsciiAlpha(c) || base::IsAsciiDigit(c) || c == '-' || c == '_';
}
-// Joins a std::vector<base::StringPiece> into a single std::string.
-// TODO(constantina): Implement a base::JoinString() that takes StringPieces.
-// i.e. move this to base/strings/string_util.h, and thoroughly test.
-std::string JoinString(const std::vector<base::StringPiece>& pieces) {
- size_t total_size = 0;
- for (const auto& piece : pieces) {
- total_size += piece.size();
- }
- std::string joined_pieces;
- joined_pieces.reserve(total_size);
-
- for (const auto& piece : pieces) {
- piece.AppendToString(&joined_pieces);
- }
- return joined_pieces;
-}
-
} // namespace
// static
@@ -109,7 +92,7 @@ bool ShareServiceImpl::ReplacePlaceholders(base::StringPiece url_template,
split_template.push_back(url_template.substr(
start_index_to_copy, url_template.size() - start_index_to_copy));
- *url_template_filled = JoinString(split_template);
+ *url_template_filled = base::JoinStringPiece(split_template, "");
return true;
}
« base/strings/string_util.cc ('K') | « base/strings/string_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698