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

Unified Diff: base/i18n/file_util_icu.cc

Issue 2042003: Switch some Singletons to use LeakySingleton. Base URL: http://src.chromium.org/git/chromium.git
Patch Set: More build fixes. Created 10 years, 7 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
« no previous file with comments | « base/debug_util_win.cc ('k') | base/i18n/number_formatting.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/i18n/file_util_icu.cc
diff --git a/base/i18n/file_util_icu.cc b/base/i18n/file_util_icu.cc
index 0e9c2cddecfd2bc4362cf973b02caf24648f93b9..6da6a8738d619a6b36d37c38b097a4c9b7f8b204 100644
--- a/base/i18n/file_util_icu.cc
+++ b/base/i18n/file_util_icu.cc
@@ -30,7 +30,6 @@ class IllegalCharacters {
}
private:
- friend class Singleton<IllegalCharacters>;
friend struct DefaultSingletonTraits<IllegalCharacters>;
IllegalCharacters();
@@ -123,19 +122,19 @@ class LocaleAwareComparator {
namespace file_util {
bool IsFilenameLegal(const string16& file_name) {
- return Singleton<IllegalCharacters>()->containsNone(file_name);
+ return LeakySingleton<IllegalCharacters>()->containsNone(file_name);
}
void ReplaceIllegalCharactersInPath(FilePath::StringType* file_name,
char replace_char) {
DCHECK(file_name);
- DCHECK(!(Singleton<IllegalCharacters>()->contains(replace_char)));
+ DCHECK(!(LeakySingleton<IllegalCharacters>()->contains(replace_char)));
// Remove leading and trailing whitespace.
TrimWhitespace(*file_name, TRIM_ALL, file_name);
- IllegalCharacters* illegal = Singleton<IllegalCharacters>::get();
+ IllegalCharacters* illegal = LeakySingleton<IllegalCharacters>::get();
int cursor = 0; // The ICU macros expect an int.
while (cursor < static_cast<int>(file_name->size())) {
int char_begin = cursor;
@@ -171,8 +170,8 @@ void ReplaceIllegalCharactersInPath(FilePath::StringType* file_name,
bool LocaleAwareCompareFilenames(const FilePath& a, const FilePath& b) {
#if defined(OS_WIN)
- return Singleton<LocaleAwareComparator>()->Compare(a.value().c_str(),
- b.value().c_str()) < 0;
+ return LeakySingleton<LocaleAwareComparator>()->Compare(
+ a.value().c_str(), b.value().c_str()) < 0;
#elif defined(OS_POSIX)
// On linux, the file system encoding is not defined. We assume
@@ -181,7 +180,7 @@ bool LocaleAwareCompareFilenames(const FilePath& a, const FilePath& b) {
// ICU's collator can take strings in OS native encoding. But we convert the
// strings to UTF-16 ourselves to ensure conversion consistency.
// TODO(yuzo): Perhaps we should define SysNativeMBToUTF16?
- return Singleton<LocaleAwareComparator>()->Compare(
+ return LeakySingleton<LocaleAwareComparator>()->Compare(
WideToUTF16(base::SysNativeMBToWide(a.value().c_str())),
WideToUTF16(base::SysNativeMBToWide(b.value().c_str()))) < 0;
#else
« no previous file with comments | « base/debug_util_win.cc ('k') | base/i18n/number_formatting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698