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

Unified Diff: base/i18n/icu_util.cc

Issue 1124763003: Update from https://crrev.com/327068 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: update nacl, buildtools, fix display_change_notifier_unittest Created 5 years, 7 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
diff --git a/base/i18n/icu_util.cc b/base/i18n/icu_util.cc
index f1fdda7458782d509a8631fb0b6a56d76f96dbf6..76eaa62ff783ac8019cf41a4e8c0483950c14007 100644
--- a/base/i18n/icu_util.cc
+++ b/base/i18n/icu_util.cc
@@ -10,6 +10,7 @@
#include <string>
+#include "base/debug/alias.h"
#include "base/files/file_path.h"
#include "base/files/memory_mapped_file.h"
#include "base/logging.h"
@@ -48,7 +49,9 @@ namespace {
// 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.
+#if !defined(OS_NACL)
bool g_called_once = false;
+#endif
bool g_check_called_once = true;
#endif
}
@@ -81,6 +84,7 @@ bool InitializeICUWithFileDescriptor(
#endif
+#if !defined(OS_NACL)
bool InitializeICU() {
#if !defined(NDEBUG)
DCHECK(!g_check_called_once || !g_called_once);
@@ -127,6 +131,10 @@ bool InitializeICU() {
#if defined(OS_WIN)
// The data file will be in the same directory as the current module.
bool path_ok = PathService::Get(base::DIR_MODULE, &data_path);
+ wchar_t tmp_buffer[_MAX_PATH] = {0};
+ wcscpy_s(tmp_buffer, data_path.value().c_str());
+ base::debug::Alias(tmp_buffer);
+ CHECK(path_ok); // TODO(scottmg): http://crbug.com/445616
#elif defined(OS_ANDROID)
bool path_ok = PathService::Get(base::DIR_ANDROID_APP_DATA, &data_path);
#else
@@ -137,6 +145,14 @@ bool InitializeICU() {
#endif
DCHECK(path_ok);
data_path = data_path.AppendASCII(kIcuDataFileName);
+
+#if defined(OS_WIN)
+ // TODO(scottmg): http://crbug.com/445616
+ wchar_t tmp_buffer2[_MAX_PATH] = {0};
+ wcscpy_s(tmp_buffer2, data_path.value().c_str());
+ base::debug::Alias(tmp_buffer2);
+#endif
+
#else
// Assume it is in the framework bundle's Resources directory.
base::ScopedCFTypeRef<CFStringRef> data_file_name(
@@ -149,15 +165,22 @@ bool InitializeICU() {
}
#endif // OS check
if (!mapped_file.Initialize(data_path)) {
+#if defined(OS_WIN)
+ CHECK(false); // TODO(scottmg): http://crbug.com/445616
+#endif
LOG(ERROR) << "Couldn't mmap " << data_path.AsUTF8Unsafe();
return false;
}
}
UErrorCode err = U_ZERO_ERROR;
udata_setCommonData(const_cast<uint8*>(mapped_file.data()), &err);
+#if defined(OS_WIN)
+ CHECK(err == U_ZERO_ERROR); // TODO(scottmg): http://crbug.com/445616
+#endif
return err == U_ZERO_ERROR;
#endif
}
+#endif
void AllowMultipleInitializeCallsForTesting() {
#if !defined(NDEBUG)
« no previous file with comments | « base/i18n/icu_util.h ('k') | base/i18n/string_compare.h » ('j') | mojo/public/tools/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698