| 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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 #if defined(OS_IOS) | 31 #if defined(OS_IOS) |
| 32 #include "base/ios/ios_util.h" | 32 #include "base/ios/ios_util.h" |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 #if defined(OS_MACOSX) | 35 #if defined(OS_MACOSX) |
| 36 #include "base/mac/foundation_util.h" | 36 #include "base/mac/foundation_util.h" |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 #define ICU_UTIL_DATA_FILE 0 | |
| 40 #define ICU_UTIL_DATA_SHARED 1 | |
| 41 #define ICU_UTIL_DATA_STATIC 2 | |
| 42 | |
| 43 namespace base { | 39 namespace base { |
| 44 namespace i18n { | 40 namespace i18n { |
| 45 | 41 |
| 46 #if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_SHARED | 42 #if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_SHARED |
| 47 #define ICU_UTIL_DATA_SYMBOL "icudt" U_ICU_VERSION_SHORT "_dat" | 43 #define ICU_UTIL_DATA_SYMBOL "icudt" U_ICU_VERSION_SHORT "_dat" |
| 48 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
| 49 #define ICU_UTIL_DATA_SHARED_MODULE_NAME "icudt.dll" | 45 #define ICU_UTIL_DATA_SHARED_MODULE_NAME "icudt.dll" |
| 50 #endif | 46 #endif |
| 51 #endif | 47 #endif |
| 52 | 48 |
| 53 namespace { | 49 namespace { |
| 54 #if !defined(OS_NACL) | 50 #if !defined(OS_NACL) |
| 55 #if !defined(NDEBUG) | 51 #if !defined(NDEBUG) |
| 56 // Assert that we are not called more than once. Even though calling this | 52 // Assert that we are not called more than once. Even though calling this |
| 57 // function isn't harmful (ICU can handle it), being called twice probably | 53 // function isn't harmful (ICU can handle it), being called twice probably |
| 58 // indicates a programming error. | 54 // indicates a programming error. |
| 59 bool g_check_called_once = true; | 55 bool g_check_called_once = true; |
| 60 bool g_called_once = false; | 56 bool g_called_once = false; |
| 61 #endif // !defined(NDEBUG) | 57 #endif // !defined(NDEBUG) |
| 62 | 58 |
| 59 #if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE |
| 60 |
| 63 // To debug http://crbug.com/445616. | 61 // To debug http://crbug.com/445616. |
| 64 int g_debug_icu_last_error; | 62 int g_debug_icu_last_error; |
| 65 int g_debug_icu_load; | 63 int g_debug_icu_load; |
| 66 int g_debug_icu_pf_error_details; | 64 int g_debug_icu_pf_error_details; |
| 67 int g_debug_icu_pf_last_error; | 65 int g_debug_icu_pf_last_error; |
| 68 #if defined(OS_WIN) | 66 #if defined(OS_WIN) |
| 69 wchar_t g_debug_icu_pf_filename[_MAX_PATH]; | 67 wchar_t g_debug_icu_pf_filename[_MAX_PATH]; |
| 70 #endif // OS_WIN | 68 #endif // OS_WIN |
| 71 | |
| 72 #if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE | |
| 73 // Use an unversioned file name to simplify a icu version update down the road. | 69 // Use an unversioned file name to simplify a icu version update down the road. |
| 74 // No need to change the filename in multiple places (gyp files, windows | 70 // No need to change the filename in multiple places (gyp files, windows |
| 75 // build pkg configurations, etc). 'l' stands for Little Endian. | 71 // build pkg configurations, etc). 'l' stands for Little Endian. |
| 76 // This variable is exported through the header file. | 72 // This variable is exported through the header file. |
| 77 const char kIcuDataFileName[] = "icudtl.dat"; | 73 const char kIcuDataFileName[] = "icudtl.dat"; |
| 78 #if defined(OS_ANDROID) | 74 #if defined(OS_ANDROID) |
| 79 const char kAndroidAssetsIcuDataFileName[] = "assets/icudtl.dat"; | 75 const char kAndroidAssetsIcuDataFileName[] = "assets/icudtl.dat"; |
| 80 #endif | 76 #endif |
| 81 | 77 |
| 82 // File handle intentionally never closed. Not using File here because its | 78 // File handle intentionally never closed. Not using File here because its |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 #endif // !defined(OS_NACL) | 313 #endif // !defined(OS_NACL) |
| 318 | 314 |
| 319 void AllowMultipleInitializeCallsForTesting() { | 315 void AllowMultipleInitializeCallsForTesting() { |
| 320 #if !defined(NDEBUG) && !defined(OS_NACL) | 316 #if !defined(NDEBUG) && !defined(OS_NACL) |
| 321 g_check_called_once = false; | 317 g_check_called_once = false; |
| 322 #endif | 318 #endif |
| 323 } | 319 } |
| 324 | 320 |
| 325 } // namespace i18n | 321 } // namespace i18n |
| 326 } // namespace base | 322 } // namespace base |
| OLD | NEW |