Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(647)

Unified Diff: third_party/WebKit/Source/platform/LayoutLocale.cpp

Issue 2213393002: Defer computing localeForHan until needed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: drott review Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/LayoutLocale.cpp
diff --git a/third_party/WebKit/Source/platform/LayoutLocale.cpp b/third_party/WebKit/Source/platform/LayoutLocale.cpp
index 0a930c9f931e369448c1314a37a8357756a57c59..a5578dab9eba533339cd324a41eed20d56a27375 100644
--- a/third_party/WebKit/Source/platform/LayoutLocale.cpp
+++ b/third_party/WebKit/Source/platform/LayoutLocale.cpp
@@ -5,6 +5,7 @@
#include "platform/LayoutLocale.h"
#include "platform/Language.h"
+#include "platform/fonts/AcceptLanguagesResolver.h"
#include "platform/text/LocaleToScriptMapping.h"
#include "wtf/HashMap.h"
#include "wtf/text/AtomicStringHash.h"
@@ -99,13 +100,13 @@ const LayoutLocale* LayoutLocale::localeForHan(const LayoutLocale* contentLocale
if (contentLocale && contentLocale->hasScriptForHan())
return contentLocale;
if (!s_defaultForHanComputed)
- setLocaleForHan(nullptr);
+ computeLocaleForHan();
return s_defaultForHan;
}
-void LayoutLocale::setLocaleForHan(const LayoutLocale* locale)
+void LayoutLocale::computeLocaleForHan()
{
- if (locale)
+ if (const LayoutLocale* locale = AcceptLanguagesResolver::localeForHan())
s_defaultForHan = locale;
else if (getDefault().hasScriptForHan())
s_defaultForHan = &getDefault();
« no previous file with comments | « third_party/WebKit/Source/platform/LayoutLocale.h ('k') | third_party/WebKit/Source/platform/fonts/AcceptLanguagesResolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698