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

Side by Side Diff: third_party/WebKit/Source/platform/LayoutLocale.h

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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/LayoutLocale.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef LayoutLocale_h 5 #ifndef LayoutLocale_h
6 #define LayoutLocale_h 6 #define LayoutLocale_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "platform/text/Hyphenation.h" 9 #include "platform/text/Hyphenation.h"
10 #include "wtf/Forward.h" 10 #include "wtf/Forward.h"
(...skipping 24 matching lines...) Expand all
35 CString ascii() const { return m_string.ascii(); } 35 CString ascii() const { return m_string.ascii(); }
36 36
37 const hb_language_impl_t* harfbuzzLanguage() const { return m_harfbuzzLangua ge; } 37 const hb_language_impl_t* harfbuzzLanguage() const { return m_harfbuzzLangua ge; }
38 const char* localeForSkFontMgr() const; 38 const char* localeForSkFontMgr() const;
39 UScriptCode script() const { return m_script; } 39 UScriptCode script() const { return m_script; }
40 40
41 // Disambiguation of the Unified Han Ideographs. 41 // Disambiguation of the Unified Han Ideographs.
42 UScriptCode scriptForHan() const; 42 UScriptCode scriptForHan() const;
43 bool hasScriptForHan() const; 43 bool hasScriptForHan() const;
44 static const LayoutLocale* localeForHan(const LayoutLocale*); 44 static const LayoutLocale* localeForHan(const LayoutLocale*);
45 static void setLocaleForHan(const LayoutLocale*); 45 static void invalidateLocaleForHan() { s_defaultForHanComputed = false; }
46 const char* localeForHanForSkFontMgr() const; 46 const char* localeForHanForSkFontMgr() const;
47 47
48 Hyphenation* getHyphenation() const; 48 Hyphenation* getHyphenation() const;
49 49
50 static PassRefPtr<LayoutLocale> createForTesting(const AtomicString&); 50 static PassRefPtr<LayoutLocale> createForTesting(const AtomicString&);
51 static void clearForTesting(); 51 static void clearForTesting();
52 static void setHyphenationForTesting(const AtomicString&, PassRefPtr<Hyphena tion>); 52 static void setHyphenationForTesting(const AtomicString&, PassRefPtr<Hyphena tion>);
53 53
54 private: 54 private:
55 explicit LayoutLocale(const AtomicString&); 55 explicit LayoutLocale(const AtomicString&);
56 56
57 void computeScriptForHan() const; 57 void computeScriptForHan() const;
58 static void computeLocaleForHan();
58 59
59 AtomicString m_string; 60 AtomicString m_string;
60 mutable CString m_stringForSkFontMgr; 61 mutable CString m_stringForSkFontMgr;
61 mutable RefPtr<Hyphenation> m_hyphenation; 62 mutable RefPtr<Hyphenation> m_hyphenation;
62 63
63 // hb_language_t is defined in hb.h, which not all files can include. 64 // hb_language_t is defined in hb.h, which not all files can include.
64 const hb_language_impl_t* m_harfbuzzLanguage; 65 const hb_language_impl_t* m_harfbuzzLanguage;
65 66
66 UScriptCode m_script; 67 UScriptCode m_script;
67 mutable UScriptCode m_scriptForHan; 68 mutable UScriptCode m_scriptForHan;
68 69
69 mutable unsigned m_hasScriptForHan : 1; 70 mutable unsigned m_hasScriptForHan : 1;
70 mutable unsigned m_hyphenationComputed : 1; 71 mutable unsigned m_hyphenationComputed : 1;
71 72
72 static const LayoutLocale* s_default; 73 static const LayoutLocale* s_default;
73 static const LayoutLocale* s_system; 74 static const LayoutLocale* s_system;
74 static const LayoutLocale* s_defaultForHan; 75 static const LayoutLocale* s_defaultForHan;
75 static bool s_defaultForHanComputed; 76 static bool s_defaultForHanComputed;
76 }; 77 };
77 78
78 } // namespace blink 79 } // namespace blink
79 80
80 #endif // LayoutLocale_h 81 #endif // LayoutLocale_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/LayoutLocale.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698