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

Unified Diff: third_party/WebKit/Source/wtf/text/WTFString.cpp

Issue 2668903003: Replace WTF::emptyString{16Bit}() with a static global (Closed)
Patch Set: Replace WTF::emptyString{16Bit}() with a static global Created 3 years, 11 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
Index: third_party/WebKit/Source/wtf/text/WTFString.cpp
diff --git a/third_party/WebKit/Source/wtf/text/WTFString.cpp b/third_party/WebKit/Source/wtf/text/WTFString.cpp
index 95c41594c0c90ad1e6b16fbc08999f564f5a89b6..b547cbdf993b0a448a1d25a79df6adb28d5a21fa 100644
--- a/third_party/WebKit/Source/wtf/text/WTFString.cpp
+++ b/third_party/WebKit/Source/wtf/text/WTFString.cpp
@@ -709,7 +709,7 @@ CString String::utf8(UTF8ConversionMode mode) const {
String String::make8BitFrom16BitSource(const UChar* source, size_t length) {
if (!length)
- return emptyString();
+ return emptyString;
LChar* destination;
String result = String::createUninitialized(length, destination);
@@ -721,7 +721,7 @@ String String::make8BitFrom16BitSource(const UChar* source, size_t length) {
String String::make16BitFrom8BitSource(const LChar* source, size_t length) {
if (!length)
- return emptyString16Bit();
+ return emptyString16Bit;
UChar* destination;
String result = String::createUninitialized(length, destination);
@@ -738,7 +738,7 @@ String String::fromUTF8(const LChar* stringStart, size_t length) {
return String();
if (!length)
- return emptyString();
+ return emptyString;
if (charactersAreAllASCII(stringStart, length))
return StringImpl::create(stringStart, length);
@@ -775,16 +775,6 @@ String String::fromUTF8WithLatin1Fallback(const LChar* string, size_t size) {
return utf8;
}
-const String& emptyString() {
- DEFINE_STATIC_LOCAL(String, emptyString, (StringImpl::empty));
- return emptyString;
-}
-
-const String& emptyString16Bit() {
- DEFINE_STATIC_LOCAL(String, emptyString, (StringImpl::empty16Bit));
- return emptyString;
-}
-
std::ostream& operator<<(std::ostream& out, const String& string) {
if (string.isNull())
return out << "<null>";
« no previous file with comments | « third_party/WebKit/Source/wtf/text/WTFString.h ('k') | third_party/WebKit/Source/wtf/text/WTFStringTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698