OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/i18n/icu_util.h" | 5 #include "base/i18n/icu_util.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 #if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE | 44 #if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE |
45 #define ICU_UTIL_DATA_FILE_NAME "icudt" U_ICU_VERSION_SHORT "l.dat" | 45 #define ICU_UTIL_DATA_FILE_NAME "icudt" U_ICU_VERSION_SHORT "l.dat" |
46 #elif ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_SHARED | 46 #elif ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_SHARED |
47 #define ICU_UTIL_DATA_SYMBOL "icudt" U_ICU_VERSION_SHORT "_dat" | 47 #define ICU_UTIL_DATA_SYMBOL "icudt" U_ICU_VERSION_SHORT "_dat" |
48 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
49 #define ICU_UTIL_DATA_SHARED_MODULE_NAME "icudt.dll" | 49 #define ICU_UTIL_DATA_SHARED_MODULE_NAME "icudt.dll" |
50 #endif | 50 #endif |
51 #endif | 51 #endif |
52 | 52 |
53 using base::FilePath; | 53 namespace base { |
| 54 namespace i18n { |
54 | 55 |
55 namespace icu_util { | 56 bool InitializeICU() { |
56 | |
57 bool Initialize() { | |
58 #ifndef NDEBUG | 57 #ifndef NDEBUG |
59 // Assert that we are not called more than once. Even though calling this | 58 // Assert that we are not called more than once. Even though calling this |
60 // function isn't harmful (ICU can handle it), being called twice probably | 59 // function isn't harmful (ICU can handle it), being called twice probably |
61 // indicates a programming error. | 60 // indicates a programming error. |
62 static bool called_once = false; | 61 static bool called_once = false; |
63 DCHECK(!called_once); | 62 DCHECK(!called_once); |
64 called_once = true; | 63 called_once = true; |
65 #endif | 64 #endif |
66 | 65 |
67 #if (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_SHARED) | 66 #if (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_SHARED) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 return false; | 124 return false; |
126 } | 125 } |
127 } | 126 } |
128 UErrorCode err = U_ZERO_ERROR; | 127 UErrorCode err = U_ZERO_ERROR; |
129 udata_setCommonData(const_cast<uint8*>(mapped_file.data()), &err); | 128 udata_setCommonData(const_cast<uint8*>(mapped_file.data()), &err); |
130 return err == U_ZERO_ERROR; | 129 return err == U_ZERO_ERROR; |
131 #endif // OS check | 130 #endif // OS check |
132 #endif | 131 #endif |
133 } | 132 } |
134 | 133 |
135 } // namespace icu_util | 134 } // namespace i18n |
| 135 } // namespace base |
OLD | NEW |