From 54e644a28661eb9039afdaacce8292a8cabfb307 Mon Sep 17 00:00:00 2001 From: "jshin@chromium.org" Date: Sat, 1 Feb 2014 01:44:45 +0000 Subject: [PATCH] Enable icu_use_data_file_flag on CrOS 1. Enable icu_use_data_file_flag on CrOS 2. Doing #1 led to a crash because GetStringUTF8 (that relies on ICU to determine whether the current UI language is RTL) is called before InitializeICU is called. Instead of using GetStringUTF8, get the string directly from the resource bundle because there's no need to adjust the string for the RTL locale in this particular case. Note to perf-sheriff : The size of chrome binary will be 10M smaller because the ICU data is now in a separate file (icudtl.dat) whose size is about 10M. BUG=72633 TEST=ui_base_unittests Review URL: https://codereview.chromium.org/135963010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248325 0039d316-1c4b-4281-b951-d872f2087c98 --- DEPS | 2 +- build/common.gypi | 4 ++-- ui/base/resource/resource_bundle.cc | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/DEPS b/DEPS index f2f4641af653c..0de2e218afb8e 100644 --- a/DEPS +++ b/DEPS @@ -482,7 +482,7 @@ deps_os = { # Build tools for targeting ChromeOS. "src/third_party/chromite": Var("chromiumos_git") + "/chromite.git" + - "@6637dcd35a8b9f02ba54d2a369118306cee88432", + "@1ee2901d33ae698d1f2a1d95e9f3fd5bbd5f13f9", # Dependency of chromite.git. "src/third_party/pyelftools": diff --git a/build/common.gypi b/build/common.gypi index 91cfd0bd15408..46b267da9f3a5 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -1304,8 +1304,8 @@ # can use breakpad for these builds. 'release_unwind_tables%': 0, }], - # TODO(jungshik): Turn this on on Android and CrOS as well. - ['OS!="android" and chromeos==0', { + # TODO(jungshik): Turn this on on Android. + ['OS!="android"', { 'icu_use_data_file_flag%': 1, }], ], diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index 46db04e4c4b5d..aa0b6f5de93da 100644 --- a/ui/base/resource/resource_bundle.cc +++ b/ui/base/resource/resource_bundle.cc @@ -68,14 +68,15 @@ ResourceBundle* g_shared_instance_ = NULL; void InitDefaultFontList() { #if defined(OS_CHROMEOS) - gfx::FontList::SetDefaultFontDescription( - l10n_util::GetStringUTF8(IDS_UI_FONT_FAMILY_CROS)); + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + std::string font_family = base::UTF16ToUTF8( + rb.GetLocalizedString(IDS_UI_FONT_FAMILY_CROS)); + gfx::FontList::SetDefaultFontDescription(font_family); // TODO(yukishiino): Remove SetDefaultFontDescription() once the migration to // the font list is done. We will no longer need SetDefaultFontDescription() // after every client gets started using a FontList instead of a Font. - gfx::PlatformFontPango::SetDefaultFontDescription( - l10n_util::GetStringUTF8(IDS_UI_FONT_FAMILY_CROS)); + gfx::PlatformFontPango::SetDefaultFontDescription(font_family); #else // Use a single default font as the default font list. gfx::FontList::SetDefaultFontDescription(std::string());