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

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

Issue 2691193002: Added StringPiece overloads for base::JoinString. (Closed)
Patch Set: Use default constructor instead of empty string quotes. 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
« no previous file with comments | « 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 608707fcad5e188c7de11184f939b3d31d3d453a..0e6a6709b69873c9021ca6ff623bade082494630 100644
--- a/chrome/browser/webshare/share_service_impl.cc
+++ b/chrome/browser/webshare/share_service_impl.cc
@@ -29,23 +29,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
ShareServiceImpl::ShareServiceImpl() : weak_factory_(this) {}
@@ -115,7 +98,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::JoinString(split_template, base::StringPiece());
return true;
}
« no previous file with comments | « base/strings/string_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698