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

Unified Diff: Source/platform/fonts/FontDescription.cpp

Issue 924903002: Don't allocate Strings in FontDescription(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « Source/platform/fonts/FontDescription.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/FontDescription.cpp
diff --git a/Source/platform/fonts/FontDescription.cpp b/Source/platform/fonts/FontDescription.cpp
index 7a9d0b9b5606b2a5ec65409bef47764fb8e55cbd..85d0035d9ede83e326602953a3484be49e24ed30 100644
--- a/Source/platform/fonts/FontDescription.cpp
+++ b/Source/platform/fonts/FontDescription.cpp
@@ -39,7 +39,7 @@ namespace blink {
struct SameSizeAsFontDescription {
FontFamily familyList;
RefPtr<FontFeatureSettings> m_featureSettings;
- String locale;
+ AtomicString locale;
float sizes[4];
// FXIME: Make them fit into one word.
uint32_t bitfields;
@@ -123,6 +123,21 @@ FontDescription::VariantLigatures FontDescription::variantLigatures() const
return ligatures;
}
+static const AtomicString& defaultLocale()
+{
+ DEFINE_STATIC_LOCAL(AtomicString, locale, ());
+ if (locale.isNull())
+ locale = AtomicString("en");
+ return locale;
+}
+
+const AtomicString& FontDescription::locale() const
+{
+ if (m_locale.isNull())
+ return defaultLocale();
+ return m_locale;
+}
+
void FontDescription::setTraits(FontTraits traits)
{
setStyle(traits.style());
« no previous file with comments | « Source/platform/fonts/FontDescription.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698