OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // File utilities that use the ICU library go in this file. | 5 // File utilities that use the ICU library go in this file. |
6 | 6 |
7 #include "base/i18n/file_util_icu.h" | 7 #include "base/i18n/file_util_icu.h" |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 for (int i = 0; i <= 0x10; ++i) { | 74 for (int i = 0; i <= 0x10; ++i) { |
75 int plane_base = 0x10000 * i; | 75 int plane_base = 0x10000 * i; |
76 set->add(plane_base + 0xFFFE, plane_base + 0xFFFF); | 76 set->add(plane_base + 0xFFFE, plane_base + 0xFFFF); |
77 } | 77 } |
78 set->freeze(); | 78 set->freeze(); |
79 } | 79 } |
80 | 80 |
81 class LocaleAwareComparator { | 81 class LocaleAwareComparator { |
82 public: | 82 public: |
83 static LocaleAwareComparator* GetInstance() { | 83 static LocaleAwareComparator* GetInstance() { |
84 return Singleton<LocaleAwareComparator>::get(); | 84 return Singleton<LocaleAwareComparator, |
85 LeakySingletonTraits<LocaleAwareComparator> >::get(); | |
eroman
2010/12/22 00:51:47
What is this change for?
willchan no longer on Chromium
2010/12/22 02:04:01
This is explained in the changelist description.
| |
85 } | 86 } |
86 | 87 |
87 // Note: A similar function is available in l10n_util. | 88 // Note: A similar function is available in l10n_util. |
88 // We cannot use it because base should not depend on l10n_util. | 89 // We cannot use it because base should not depend on l10n_util. |
89 // TODO(yuzo): Move some of l10n_util to base. | 90 // TODO(yuzo): Move some of l10n_util to base. |
90 int Compare(const string16& a, const string16& b) { | 91 int Compare(const string16& a, const string16& b) { |
91 // We are not sure if Collator::compare is thread-safe. | 92 // We are not sure if Collator::compare is thread-safe. |
92 // Use an AutoLock just in case. | 93 // Use an AutoLock just in case. |
93 AutoLock auto_lock(lock_); | 94 AutoLock auto_lock(lock_); |
94 | 95 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 // TODO(yuzo): Perhaps we should define SysNativeMBToUTF16? | 192 // TODO(yuzo): Perhaps we should define SysNativeMBToUTF16? |
192 return LocaleAwareComparator::GetInstance()->Compare( | 193 return LocaleAwareComparator::GetInstance()->Compare( |
193 WideToUTF16(base::SysNativeMBToWide(a.value().c_str())), | 194 WideToUTF16(base::SysNativeMBToWide(a.value().c_str())), |
194 WideToUTF16(base::SysNativeMBToWide(b.value().c_str()))) < 0; | 195 WideToUTF16(base::SysNativeMBToWide(b.value().c_str()))) < 0; |
195 #else | 196 #else |
196 #error Not implemented on your system | 197 #error Not implemented on your system |
197 #endif | 198 #endif |
198 } | 199 } |
199 | 200 |
200 } // namespace | 201 } // namespace |
OLD | NEW |