From 0a07797d0adb98633044038761f7bfdcd8a03a41 Mon Sep 17 00:00:00 2001 From: "jshin@chromium.org" Date: Fri, 24 Jan 2014 01:00:41 +0000 Subject: [Backport] Enable icu_use_data_file on Windows BUG=72633,337116 Review URL: https://codereview.chromium.org/99473012 Change-Id: I70c2a17ec8a69542c850089b09e19c5873470a1a Reviewed-by: Michael Bruning --- chromium/base/base.gyp | 22 ++++++++++++---------- chromium/base/i18n/icu_util.cc | 9 +++++++-- chromium/build/common.gypi | 1 + chromium/net/net.gyp | 27 ++++++++++++++++++--------- 4 files changed, 38 insertions(+), 21 deletions(-) diff --git a/chromium/base/base.gyp b/chromium/base/base.gyp index b5af9d76e1a..74edba8e338 100644 --- a/chromium/base/base.gyp +++ b/chromium/base/base.gyp @@ -795,11 +795,6 @@ }, ], ['OS == "win"', { - # This is needed to trigger the dll copy step on windows. - # TODO(mark): This should not be necessary. - 'dependencies': [ - '../third_party/icu/icu.gyp:icudata', - ], 'sources!': [ 'file_descriptor_shuffle_unittest.cc', 'files/dir_reader_posix_unittest.cc', @@ -810,17 +805,24 @@ 'msvs_disabled_warnings': [ 4267, ], - # This is needed so base_unittests uses the allocator shim, as - # SecurityTest.MemoryAllocationRestriction* tests are dependent - # on tcmalloc. - # TODO(wfh): crbug.com/246278 Move tcmalloc specific tests into - # their own test suite. 'conditions': [ + # This is needed so base_unittests uses the allocator shim, as + # SecurityTest.MemoryAllocationRestriction* tests are dependent + # on tcmalloc. + # TODO(wfh): crbug.com/246278 Move tcmalloc specific tests into + # their own test suite. ['win_use_allocator_shim==1', { 'dependencies': [ 'allocator/allocator.gyp:allocator', ], }], + ['icu_use_data_file_flag==0', { + # This is needed to trigger the dll copy step on windows. + # TODO(mark): This should not be necessary. + 'dependencies': [ + '../third_party/icu/icu.gyp:icudata', + ], + }], ], }, { # OS != "win" 'dependencies': [ diff --git a/chromium/base/i18n/icu_util.cc b/chromium/base/i18n/icu_util.cc index e5c698475e4..7df82302603 100644 --- a/chromium/base/i18n/icu_util.cc +++ b/chromium/base/i18n/icu_util.cc @@ -88,11 +88,16 @@ bool InitializeICU() { if (!mapped_file.IsValid()) { // Assume it is in the framework bundle's Resources directory. #if !defined(OS_MACOSX) + FilePath data_path; +#if defined(OS_WIN) + // The data file will be in the same directory as the current module. + bool path_ok = PathService::Get(base::DIR_MODULE, &data_path); +#else // For now, expect the data file to be alongside the executable. // This is sufficient while we work on unit tests, but will eventually // likely live in a data directory. - FilePath data_path; bool path_ok = PathService::Get(base::DIR_EXE, &data_path); +#endif DCHECK(path_ok); data_path = data_path.AppendASCII(ICU_UTIL_DATA_FILE_NAME); #else @@ -104,7 +109,7 @@ bool InitializeICU() { } #endif // OS check if (!mapped_file.Initialize(data_path)) { - DLOG(ERROR) << "Couldn't mmap " << data_path.value(); + DLOG(ERROR) << "Couldn't mmap " << data_path.AsUTF8Unsafe(); return false; } } diff --git a/chromium/build/common.gypi b/chromium/build/common.gypi index e995bd644eb..9af0b336092 100644 --- a/chromium/build/common.gypi +++ b/chromium/build/common.gypi @@ -1280,6 +1280,7 @@ }], ['OS=="win"', { 'windows_driver_kit_path%': '$(WDK_DIR)', + 'icu_use_data_file_flag%': 1, # Set the python arch to prevent conflicts with pyauto on Win64 build. # TODO(jschuh): crbug.com/177664 Investigate Win64 pyauto build. 'python_arch%': 'ia32', diff --git a/chromium/net/net.gyp b/chromium/net/net.gyp index 69f482751c9..a9ceae21bc8 100644 --- a/chromium/net/net.gyp +++ b/chromium/net/net.gyp @@ -2188,14 +2188,20 @@ 'dns/dns_config_service_posix_unittest.cc', 'http/http_auth_gssapi_posix_unittest.cc', ], - # This is needed to trigger the dll copy step on windows. - # TODO(mark): Specifying this here shouldn't be necessary. 'dependencies': [ - '../third_party/icu/icu.gyp:icudata', '../third_party/nss/nss.gyp:nspr', '../third_party/nss/nss.gyp:nss', 'third_party/nss/ssl.gyp:libssl', ], + 'conditions': [ + [ 'icu_use_data_file_flag == 0', { + # This is needed to trigger the dll copy step on windows. + # TODO(mark): Specifying this here shouldn't be necessary. + 'dependencies': [ + '../third_party/icu/icu.gyp:icudata', + ], + }], + ], # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. 'msvs_disabled_warnings': [4267, ], }, @@ -2294,16 +2300,19 @@ ], }, ], - # This is needed to trigger the dll copy step on windows. - # TODO(mark): Specifying this here shouldn't be necessary. [ 'OS == "win"', { - 'dependencies': [ - '../third_party/icu/icu.gyp:icudata', + 'conditions': [ + [ 'icu_use_data_file_flag == 0', { + # This is needed to trigger the dll copy step on windows. + # TODO(mark): Specifying this here shouldn't be necessary. + 'dependencies': [ + '../third_party/icu/icu.gyp:icudata', + ], + }], ], # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. 'msvs_disabled_warnings': [4267, ], - }, - ], + }], ], }, { -- cgit v1.2.3