| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // build pkg configurations, etc). 'l' stands for Little Endian. | 71 // build pkg configurations, etc). 'l' stands for Little Endian. |
| 72 // This variable is exported through the header file. | 72 // This variable is exported through the header file. |
| 73 const char kIcuDataFileName[] = "icudtl.dat"; | 73 const char kIcuDataFileName[] = "icudtl.dat"; |
| 74 #if defined(OS_ANDROID) | 74 #if defined(OS_ANDROID) |
| 75 const char kAndroidAssetsIcuDataFileName[] = "assets/icudtl.dat"; | 75 const char kAndroidAssetsIcuDataFileName[] = "assets/icudtl.dat"; |
| 76 #endif | 76 #endif |
| 77 | 77 |
| 78 // File handle intentionally never closed. Not using File here because its | 78 // File handle intentionally never closed. Not using File here because its |
| 79 // Windows implementation guards against two instances owning the same | 79 // Windows implementation guards against two instances owning the same |
| 80 // PlatformFile (which we allow since we know it is never freed). | 80 // PlatformFile (which we allow since we know it is never freed). |
| 81 const PlatformFile kInvalidPlatformFile = | |
| 82 #if defined(OS_WIN) | |
| 83 INVALID_HANDLE_VALUE; | |
| 84 #else | |
| 85 -1; | |
| 86 #endif | |
| 87 PlatformFile g_icudtl_pf = kInvalidPlatformFile; | 81 PlatformFile g_icudtl_pf = kInvalidPlatformFile; |
| 88 MemoryMappedFile* g_icudtl_mapped_file = nullptr; | 82 MemoryMappedFile* g_icudtl_mapped_file = nullptr; |
| 89 MemoryMappedFile::Region g_icudtl_region; | 83 MemoryMappedFile::Region g_icudtl_region; |
| 90 | 84 |
| 91 void LazyInitIcuDataFile() { | 85 void LazyInitIcuDataFile() { |
| 92 if (g_icudtl_pf != kInvalidPlatformFile) { | 86 if (g_icudtl_pf != kInvalidPlatformFile) { |
| 93 return; | 87 return; |
| 94 } | 88 } |
| 95 #if defined(OS_ANDROID) | 89 #if defined(OS_ANDROID) |
| 96 int fd = base::android::OpenApkAsset(kAndroidAssetsIcuDataFileName, | 90 int fd = base::android::OpenApkAsset(kAndroidAssetsIcuDataFileName, |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 #endif // !defined(OS_NACL) | 307 #endif // !defined(OS_NACL) |
| 314 | 308 |
| 315 void AllowMultipleInitializeCallsForTesting() { | 309 void AllowMultipleInitializeCallsForTesting() { |
| 316 #if !defined(NDEBUG) && !defined(OS_NACL) | 310 #if !defined(NDEBUG) && !defined(OS_NACL) |
| 317 g_check_called_once = false; | 311 g_check_called_once = false; |
| 318 #endif | 312 #endif |
| 319 } | 313 } |
| 320 | 314 |
| 321 } // namespace i18n | 315 } // namespace i18n |
| 322 } // namespace base | 316 } // namespace base |
| OLD | NEW |