summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/string_util.cc14
-rw-r--r--base/string_util_icu.cc17
2 files changed, 17 insertions, 14 deletions
diff --git a/base/string_util.cc b/base/string_util.cc
index dcc6c30..2699f26 100644
--- a/base/string_util.cc
+++ b/base/string_util.cc
@@ -1656,17 +1656,3 @@ std::string HexEncode(const void* bytes, size_t size) {
}
return ret;
}
-
-TrimPositions TrimWhitespaceUTF8(const std::string& input,
- TrimPositions positions,
- std::string* output) {
- // This implementation is not so fast since it converts the text encoding
- // twice. Please feel free to file a bug if this function hurts the
- // performance of Chrome.
- DCHECK(IsStringUTF8(input));
- std::wstring input_wide = UTF8ToWide(input);
- std::wstring output_wide;
- TrimPositions result = TrimWhitespace(input_wide, positions, &output_wide);
- *output = WideToUTF8(output_wide);
- return result;
-}
diff --git a/base/string_util_icu.cc b/base/string_util_icu.cc
index f8a2d99..9b4eab6 100644
--- a/base/string_util_icu.cc
+++ b/base/string_util_icu.cc
@@ -674,3 +674,20 @@ std::wstring FormatNumber(int64 number) {
return std::wstring(buffer, static_cast<std::wstring::size_type>(length));
#endif // defined(WCHAR_T_IS_UTF32)
}
+
+// Although this function isn't specific to ICU, we implemented it here so
+// that chrome.exe won't pull it in. Moving this function to string_util.cc
+// causes chrome.exe to grow by 400k because of more ICU being pulled in.
+TrimPositions TrimWhitespaceUTF8(const std::string& input,
+ TrimPositions positions,
+ std::string* output) {
+ // This implementation is not so fast since it converts the text encoding
+ // twice. Please feel free to file a bug if this function hurts the
+ // performance of Chrome.
+ DCHECK(IsStringUTF8(input));
+ std::wstring input_wide = UTF8ToWide(input);
+ std::wstring output_wide;
+ TrimPositions result = TrimWhitespace(input_wide, positions, &output_wide);
+ *output = WideToUTF8(output_wide);
+ return result;
+}