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

Unified Diff: base/i18n/icu_util.cc

Issue 1431133003: mandoline: Reland "Fix ICU initialization". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT and then fix compile. Created 5 years, 1 month 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') | components/html_viewer/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/i18n/icu_util.cc
diff --git a/base/i18n/icu_util.cc b/base/i18n/icu_util.cc
index 1dd54cd606d8b750663a471b4efd277e5ec4980f..e3afc049b335ca12863b9310405f274d012dace0 100644
--- a/base/i18n/icu_util.cc
+++ b/base/i18n/icu_util.cc
@@ -143,6 +143,7 @@ bool InitializeICUWithFileDescriptorInternal(
return true;
}
if (data_fd == kInvalidPlatformFile) {
+ LOG(ERROR) << "Invalid file descriptor to ICU data received.";
return false;
}
@@ -164,6 +165,7 @@ bool InitializeICUWithFileDescriptorInternal(
#if !defined(OS_NACL)
#if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE
+#if defined(OS_ANDROID)
bool InitializeICUWithFileDescriptor(
PlatformFile data_fd,
const MemoryMappedFile::Region& data_region) {
@@ -179,6 +181,28 @@ PlatformFile GetIcuDataFileHandle(MemoryMappedFile::Region* out_region) {
*out_region = g_icudtl_region;
return g_icudtl_pf;
}
+#endif
+
+const uint8* GetRawIcuMemory() {
+ CHECK(g_icudtl_mapped_file);
+ return g_icudtl_mapped_file->data();
+}
+
+bool InitializeICUFromRawMemory(const uint8* raw_memory) {
+#if !defined(COMPONENT_BUILD)
+#if !defined(NDEBUG)
+ DCHECK(!g_check_called_once || !g_called_once);
+ g_called_once = true;
+#endif
+
+ UErrorCode err = U_ZERO_ERROR;
+ udata_setCommonData(const_cast<uint8*>(raw_memory), &err);
+ return err == U_ZERO_ERROR;
+#else
+ return true;
+#endif
+}
+
#endif // ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE
bool InitializeICU() {
« no previous file with comments | « base/i18n/icu_util.h ('k') | components/html_viewer/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698