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

Unified Diff: base/i18n/icu_util.h

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 | « no previous file | base/i18n/icu_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/i18n/icu_util.h
diff --git a/base/i18n/icu_util.h b/base/i18n/icu_util.h
index d62f8bac0d946dbb09d71290f58c77b27e5ca63f..ec24426717096de792d21342b44769561424619c 100644
--- a/base/i18n/icu_util.h
+++ b/base/i18n/icu_util.h
@@ -18,16 +18,37 @@ namespace i18n {
BASE_I18N_EXPORT bool InitializeICU();
#if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE
+#if defined(OS_ANDROID)
// Returns the PlatformFile and Region that was initialized by InitializeICU().
// Use with InitializeICUWithFileDescriptor().
BASE_I18N_EXPORT PlatformFile GetIcuDataFileHandle(
MemoryMappedFile::Region* out_region);
-// Android and html_viewer use a file descriptor passed by browser process to
-// initialize ICU in render processes.
+// Android uses a file descriptor passed by browser process to initialize ICU
+// in render processes.
BASE_I18N_EXPORT bool InitializeICUWithFileDescriptor(
PlatformFile data_fd,
const MemoryMappedFile::Region& data_region);
+#endif
+
+// Returns a void pointer to the memory mapped ICU data file.
+//
+// There are cases on Android where we would be unsafely reusing a file
+// descriptor within the same process when initializing two copies of ICU from
+// different binaries in the same address space. This returns an unowned
+// pointer to the memory mapped icu data file; consumers copies of base must
+// not outlive the copy of base that owns the memory mapped file.
+BASE_I18N_EXPORT const uint8* GetRawIcuMemory();
+
+// Initializes ICU memory
+//
+// This does nothing in component builds; this initialization should only be
+// done in cases where there could be two copies of base in a single process in
+// non-component builds. (The big example is mojo: the shell will have a copy
+// of base linked in, and the majority of mojo applications will have base
+// linked in but in non-component builds, these will be separate copies of
+// base.)
+BASE_I18N_EXPORT bool InitializeICUFromRawMemory(const uint8* raw_memory);
#endif // ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE
#endif // !defined(OS_NACL)
« no previous file with comments | « no previous file | base/i18n/icu_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698