diff options
author | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-15 14:31:39 +0000 |
---|---|---|
committer | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-15 14:31:39 +0000 |
commit | 9e4142b441be48a6163173713e02622e54c99533 (patch) | |
tree | 2897a442fd301064b50a4a2de16471b9b06a17e0 /base | |
parent | 6a1f8fe0bbfba537013d2d6c7036d750e3d3fb71 (diff) | |
download | chromium_src-9e4142b441be48a6163173713e02622e54c99533.zip chromium_src-9e4142b441be48a6163173713e02622e54c99533.tar.gz chromium_src-9e4142b441be48a6163173713e02622e54c99533.tar.bz2 |
Move TrimWhitespaceUTF8 back to string_util_utf8.cc
Apparently it was there for a reason, but wasn't documented.
Review URL: http://codereview.chromium.org/155511
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20727 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/string_util.cc | 14 | ||||
-rw-r--r-- | base/string_util_icu.cc | 17 |
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; +} |