Index: base/i18n/icu_util.cc |
=================================================================== |
--- base/i18n/icu_util.cc (revision 257128) |
+++ base/i18n/icu_util.cc (working copy) |
@@ -44,14 +44,21 @@ |
namespace base { |
namespace i18n { |
+namespace { |
+ |
+#ifndef NDEBUG |
sky
2014/03/14 21:35:56
#if !defined(NDEBUG)
jam
2014/03/14 22:35:40
Done.
|
+// Assert that we are not called more than once. Even though calling this |
+// function isn't harmful (ICU can handle it), being called twice probably |
+// indicates a programming error. |
+bool g_called_once = false; |
sky
2014/03/14 21:35:56
I'm pretty sure these don't get g_ (just called_on
jam
2014/03/14 22:35:40
really? I see > 1K hits for " g_" in cs
|
+bool g_check_called_once = true; |
+#endif |
+} |
+ |
bool InitializeICU() { |
#ifndef NDEBUG |
- // Assert that we are not called more than once. Even though calling this |
- // function isn't harmful (ICU can handle it), being called twice probably |
- // indicates a programming error. |
- static bool called_once = false; |
- DCHECK(!called_once); |
- called_once = true; |
+ DCHECK(!g_check_called_once || !g_called_once); |
sky
2014/03/14 21:35:56
I'm not familiar with this code. Do you need to wo
jam
2014/03/14 22:35:40
not multiple threads, but multiple initializations
|
+ g_called_once = true; |
#endif |
#if (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_SHARED) |
@@ -124,5 +131,11 @@ |
#endif |
} |
+void AllowMultipleInitializeCallsForTesting() { |
+#ifndef NDEBUG |
sky
2014/03/14 21:35:56
#if !defined(NDEBUG)
jam
2014/03/14 22:35:40
Done.
|
+ g_check_called_once = false; |
+#endif |
+} |
+ |
} // namespace i18n |
} // namespace base |