OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_I18N_ICU_UTIL_H_ | 5 #ifndef BASE_I18N_ICU_UTIL_H_ |
6 #define BASE_I18N_ICU_UTIL_H_ | 6 #define BASE_I18N_ICU_UTIL_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include "base/files/memory_mapped_file.h" | 10 #include "base/files/memory_mapped_file.h" |
9 #include "base/i18n/base_i18n_export.h" | 11 #include "base/i18n/base_i18n_export.h" |
10 #include "build/build_config.h" | 12 #include "build/build_config.h" |
11 | 13 |
12 namespace base { | 14 namespace base { |
13 namespace i18n { | 15 namespace i18n { |
14 | 16 |
15 #if !defined(OS_NACL) | 17 #if !defined(OS_NACL) |
16 // Call this function to load ICU's data tables for the current process. This | 18 // Call this function to load ICU's data tables for the current process. This |
17 // function should be called before ICU is used. | 19 // function should be called before ICU is used. |
(...skipping 13 matching lines...) Expand all Loading... |
31 const MemoryMappedFile::Region& data_region); | 33 const MemoryMappedFile::Region& data_region); |
32 #endif | 34 #endif |
33 | 35 |
34 // Returns a void pointer to the memory mapped ICU data file. | 36 // Returns a void pointer to the memory mapped ICU data file. |
35 // | 37 // |
36 // There are cases on Android where we would be unsafely reusing a file | 38 // There are cases on Android where we would be unsafely reusing a file |
37 // descriptor within the same process when initializing two copies of ICU from | 39 // descriptor within the same process when initializing two copies of ICU from |
38 // different binaries in the same address space. This returns an unowned | 40 // different binaries in the same address space. This returns an unowned |
39 // pointer to the memory mapped icu data file; consumers copies of base must | 41 // pointer to the memory mapped icu data file; consumers copies of base must |
40 // not outlive the copy of base that owns the memory mapped file. | 42 // not outlive the copy of base that owns the memory mapped file. |
41 BASE_I18N_EXPORT const uint8* GetRawIcuMemory(); | 43 BASE_I18N_EXPORT const uint8_t* GetRawIcuMemory(); |
42 | 44 |
43 // Initializes ICU memory | 45 // Initializes ICU memory |
44 // | 46 // |
45 // This does nothing in component builds; this initialization should only be | 47 // This does nothing in component builds; this initialization should only be |
46 // done in cases where there could be two copies of base in a single process in | 48 // done in cases where there could be two copies of base in a single process in |
47 // non-component builds. (The big example is mojo: the shell will have a copy | 49 // non-component builds. (The big example is mojo: the shell will have a copy |
48 // of base linked in, and the majority of mojo applications will have base | 50 // of base linked in, and the majority of mojo applications will have base |
49 // linked in but in non-component builds, these will be separate copies of | 51 // linked in but in non-component builds, these will be separate copies of |
50 // base.) | 52 // base.) |
51 BASE_I18N_EXPORT bool InitializeICUFromRawMemory(const uint8* raw_memory); | 53 BASE_I18N_EXPORT bool InitializeICUFromRawMemory(const uint8_t* raw_memory); |
52 #endif // ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE | 54 #endif // ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE |
53 #endif // !defined(OS_NACL) | 55 #endif // !defined(OS_NACL) |
54 | 56 |
55 // In a test binary, the call above might occur twice. | 57 // In a test binary, the call above might occur twice. |
56 BASE_I18N_EXPORT void AllowMultipleInitializeCallsForTesting(); | 58 BASE_I18N_EXPORT void AllowMultipleInitializeCallsForTesting(); |
57 | 59 |
58 } // namespace i18n | 60 } // namespace i18n |
59 } // namespace base | 61 } // namespace base |
60 | 62 |
61 #endif // BASE_I18N_ICU_UTIL_H_ | 63 #endif // BASE_I18N_ICU_UTIL_H_ |
OLD | NEW |