Index: base/i18n/icu_util.cc |
=================================================================== |
--- base/i18n/icu_util.cc (revision 257432) |
+++ base/i18n/icu_util.cc (working copy) |
@@ -44,14 +44,21 @@ |
namespace base { |
namespace i18n { |
+namespace { |
+ |
+#if !defined(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. |
+bool g_called_once = false; |
+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; |
+#if !defined(NDEBUG) |
+ DCHECK(!g_check_called_once || !g_called_once); |
+ g_called_once = true; |
#endif |
#if (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_SHARED) |
@@ -124,5 +131,11 @@ |
#endif |
} |
+void AllowMultipleInitializeCallsForTesting() { |
+#if !defined(NDEBUG) |
+ g_check_called_once = false; |
+#endif |
+} |
+ |
} // namespace i18n |
} // namespace base |