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

Issue 40106: Make UTF8ToWide take a StringPiece, to avoid copying to a std::string. (Closed)

Created:
11 years, 9 months ago by Dean McNamee
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Make UTF8ToWide take a StringPiece, to avoid copying to a std::string. The previous prototype took only a std::string, unless you used the less convenient output parameter version. This required copying char* input to a std::string. Using a StringPiece the input will be implicitly both std::string and char* without any copying. This helps especially on Linux, where all input we get will be in utf8 char*.

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -2 lines) Patch
M base/string_util.h View 2 chunks +2 lines, -1 line 1 comment Download
M base/string_util_icu.cc View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 2 (0 generated)
Dean McNamee
If this goes well, I'd like to do it even more places (after some research ...
11 years, 9 months ago (2009-03-04 11:30:33 UTC) #1
darin (slow to review)
11 years, 9 months ago (2009-03-04 16:33:23 UTC) #2
LGTM

http://codereview.chromium.org/40106/diff/1/2
File base/string_util.h (right):

http://codereview.chromium.org/40106/diff/1/2#newcode185
Line 185: string16 UTF8ToUTF16(const std::string& utf8);
this looks like another good place to use this.

it'd be great too if we had a String16Piece :)

Powered by Google App Engine
This is Rietveld 408576698