Chromium Code Reviews| Index: Source/wtf/text/WTFString.cpp |
| diff --git a/Source/wtf/text/WTFString.cpp b/Source/wtf/text/WTFString.cpp |
| index d72969f19a6a82d4f4f9e513510ec2b01ad2749f..f2c9613a4c77a9f68ee47b56fcf0f5d2cba3b31d 100644 |
| --- a/Source/wtf/text/WTFString.cpp |
| +++ b/Source/wtf/text/WTFString.cpp |
| @@ -887,7 +887,7 @@ String String::make8BitFrom16BitSource(const UChar* source, size_t length) |
| String String::make16BitFrom8BitSource(const LChar* source, size_t length) |
| { |
| if (!length) |
| - return emptyString(); |
| + return emptyString(false); |
| UChar* destination; |
| String result = String::createUninitialized(length, destination); |
| @@ -1220,10 +1220,11 @@ float charactersToFloat(const UChar* data, size_t length, size_t& parsedLength) |
| return static_cast<float>(toDoubleType<UChar, AllowTrailingJunk>(data, length, 0, parsedLength)); |
| } |
| -const String& emptyString() |
| +const String& emptyString(bool is8Bit) |
| { |
| - DEFINE_STATIC_LOCAL(String, emptyString, (StringImpl::empty())); |
| - return emptyString; |
| + DEFINE_STATIC_LOCAL(String, empty8BitString, (StringImpl::empty())); |
| + DEFINE_STATIC_LOCAL(String, empty16BitString, (StringImpl::empty(false))); |
| + return is8Bit ? empty8BitString : empty16BitString; |
|
Mikhail
2014/09/22 10:26:18
I'm afraid this might affect the performance, what
|
| } |
| } // namespace WTF |