Index: base/i18n/icu_util.cc |
diff --git a/base/i18n/icu_util.cc b/base/i18n/icu_util.cc |
index 6001ea10d050e502b07b8c53b71c493a0e5956f9..7e9b6a2c8d21207b13bd2ffaf60764a06406c49b 100644 |
--- a/base/i18n/icu_util.cc |
+++ b/base/i18n/icu_util.cc |
@@ -55,6 +55,28 @@ bool g_check_called_once = true; |
#endif |
} |
+ |
+#if defined(OS_ANDROID) |
+bool InitializeICU(int data_fd) { |
jungshik at Google
2014/06/05 23:30:57
This should be no-op if DATA_STATIC is used.
Feng Qian
2014/06/06 17:40:31
What about DATA_SHARED case? Would it be the same
|
+#if !defined(NDEBUG) |
+ DCHECK(!g_check_called_once || !g_called_once); |
+ g_called_once = true; |
+#endif |
+ |
+ CR_DEFINE_STATIC_LOCAL(base::MemoryMappedFile, mapped_file, ()); |
+ if (!mapped_file.IsValid()) { |
+ if (!mapped_file.Initialize(base::File(data_fd))) { |
+ LOG(ERROR) << "Couldn't mmap icu data file"; |
+ return false; |
+ } |
+ } |
+ UErrorCode err = U_ZERO_ERROR; |
+ udata_setCommonData(const_cast<uint8*>(mapped_file.data()), &err); |
+ return err == U_ZERO_ERROR; |
+} |
+#endif |
+ |
+ |
bool InitializeICU() { |
#if !defined(NDEBUG) |
DCHECK(!g_check_called_once || !g_called_once); |