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

Unified Diff: base/string_util.cc

Issue 5527004: Access singletons with a new GetInstance() method instead of Singleton<T>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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: base/string_util.cc
diff --git a/base/string_util.cc b/base/string_util.cc
index d7b67299073d5ff67913b02400f0f9eb62528350..fc1372bb2474ec4306e03c041c62c2ddb573b72a 100644
--- a/base/string_util.cc
+++ b/base/string_util.cc
@@ -38,6 +38,10 @@ struct EmptyStrings {
const std::string s;
const std::wstring ws;
const string16 s16;
+
+ static EmptyStrings* GetInstance() {
+ return Singleton<EmptyStrings>::get();
+ }
};
// Used by ReplaceStringPlaceholders to track the position in the string of
@@ -102,15 +106,15 @@ bool IsWprintfFormatPortable(const wchar_t* format) {
const std::string& EmptyString() {
- return Singleton<EmptyStrings>::get()->s;
+ return EmptyStrings::GetInstance()->s;
}
const std::wstring& EmptyWString() {
- return Singleton<EmptyStrings>::get()->ws;
+ return EmptyStrings::GetInstance()->ws;
}
const string16& EmptyString16() {
- return Singleton<EmptyStrings>::get()->s16;
+ return EmptyStrings::GetInstance()->s16;
}
#define WHITESPACE_UNICODE \
« base/logging_win.h ('K') | « base/mime_util_xdg.cc ('k') | base/time_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698