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

Unified Diff: base/i18n/icu_util.cc

Issue 190663012: Run ContentMain in a browser_test's browser process. This removes duplication of code in the browse… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: try to fix android by restoring old path just for it Created 6 years, 9 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/i18n/icu_util.h ('k') | chrome/browser/apps/web_view_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « base/i18n/icu_util.h ('k') | chrome/browser/apps/web_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698