Commit e90a8c91 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

Check hyphenation alias before opening dictionary

This patch checks hyphenation alias first, before trying to
open dictionaries. When the `lang` attribute is aliases,
this change can reduce one IPC call.

Bug: 1116540
Change-Id: I2ffe71a7f7c063238545320b538474e0e03307b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2358714Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798523}
parent 274eb247
...@@ -183,17 +183,16 @@ static LocaleMap CreateLocaleFallbackMap() { ...@@ -183,17 +183,16 @@ static LocaleMap CreateLocaleFallbackMap() {
scoped_refptr<Hyphenation> Hyphenation::PlatformGetHyphenation( scoped_refptr<Hyphenation> Hyphenation::PlatformGetHyphenation(
const AtomicString& locale) { const AtomicString& locale) {
scoped_refptr<HyphenationMinikin> hyphenation(
base::AdoptRef(new HyphenationMinikin));
if (hyphenation->OpenDictionary(locale.LowerASCII()))
return hyphenation;
hyphenation = nullptr;
DEFINE_STATIC_LOCAL(LocaleMap, locale_fallback, (CreateLocaleFallbackMap())); DEFINE_STATIC_LOCAL(LocaleMap, locale_fallback, (CreateLocaleFallbackMap()));
const auto& it = locale_fallback.find(locale); const auto& it = locale_fallback.find(locale);
if (it != locale_fallback.end()) if (it != locale_fallback.end())
return LayoutLocale::Get(it->value)->GetHyphenation(); return LayoutLocale::Get(it->value)->GetHyphenation();
scoped_refptr<HyphenationMinikin> hyphenation(
base::AdoptRef(new HyphenationMinikin));
if (hyphenation->OpenDictionary(locale.LowerASCII()))
return hyphenation;
return nullptr; return nullptr;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment