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

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: cleanup 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
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

Powered by Google App Engine
This is Rietveld 408576698