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

Side by Side Diff: Source/platform/fonts/FontFallbackList.h

Issue 362963003: Encapsulate FontFallbackList's page access logic. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: No longer mutable, break friendship. Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/fonts/Font.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 bool loadingCustomFonts() const; 80 bool loadingCustomFonts() const;
81 bool shouldSkipDrawing() const; 81 bool shouldSkipDrawing() const;
82 82
83 FontSelector* fontSelector() const { return m_fontSelector.get(); } 83 FontSelector* fontSelector() const { return m_fontSelector.get(); }
84 // FIXME: It should be possible to combine fontSelectorVersion and generatio n. 84 // FIXME: It should be possible to combine fontSelectorVersion and generatio n.
85 unsigned fontSelectorVersion() const { return m_fontSelectorVersion; } 85 unsigned fontSelectorVersion() const { return m_fontSelectorVersion; }
86 unsigned generation() const { return m_generation; } 86 unsigned generation() const { return m_generation; }
87 87
88 WidthCache& widthCache() const { return m_widthCache; } 88 WidthCache& widthCache() const { return m_widthCache; }
89 89
90 private:
91 FontFallbackList();
92
93 const SimpleFontData* primarySimpleFontData(const FontDescription& fontDescr iption) 90 const SimpleFontData* primarySimpleFontData(const FontDescription& fontDescr iption)
94 { 91 {
95 ASSERT(isMainThread()); 92 ASSERT(isMainThread());
96 if (!m_cachedPrimarySimpleFontData) 93 if (!m_cachedPrimarySimpleFontData)
97 m_cachedPrimarySimpleFontData = determinePrimarySimpleFontData(fontD escription); 94 m_cachedPrimarySimpleFontData = determinePrimarySimpleFontData(fontD escription);
98 return m_cachedPrimarySimpleFontData; 95 return m_cachedPrimarySimpleFontData;
99 } 96 }
97 const FontData* fontDataAt(const FontDescription&, unsigned index) const;
98
99 GlyphPageTreeNode* getPageNode(unsigned pageNumber) const
100 {
101 return pageNumber ? m_pages.get(pageNumber) : m_pageZero;
102 }
103
104 void setPageNode(unsigned pageNumber, GlyphPageTreeNode* node)
105 {
106 if (pageNumber)
107 m_pages.set(pageNumber, node);
108 else
109 m_pageZero = node;
110 }
111
112 private:
113 FontFallbackList();
100 114
101 PassRefPtr<FontData> getFontData(const FontDescription&, int& familyIndex) c onst; 115 PassRefPtr<FontData> getFontData(const FontDescription&, int& familyIndex) c onst;
102 116
103 const SimpleFontData* determinePrimarySimpleFontData(const FontDescription&) const; 117 const SimpleFontData* determinePrimarySimpleFontData(const FontDescription&) const;
104 const FontData* fontDataAt(const FontDescription&, unsigned index) const;
105 118
106 void releaseFontData(); 119 void releaseFontData();
107 120
108 mutable Vector<RefPtr<FontData>, 1> m_fontList; 121 mutable Vector<RefPtr<FontData>, 1> m_fontList;
109 mutable GlyphPages m_pages; 122 GlyphPages m_pages;
110 mutable GlyphPageTreeNode* m_pageZero; 123 GlyphPageTreeNode* m_pageZero;
111 mutable const SimpleFontData* m_cachedPrimarySimpleFontData; 124 mutable const SimpleFontData* m_cachedPrimarySimpleFontData;
112 RefPtrWillBePersistent<FontSelector> m_fontSelector; 125 RefPtrWillBePersistent<FontSelector> m_fontSelector;
113 mutable WidthCache m_widthCache; 126 mutable WidthCache m_widthCache;
114 unsigned m_fontSelectorVersion; 127 unsigned m_fontSelectorVersion;
115 mutable int m_familyIndex; 128 mutable int m_familyIndex;
116 unsigned short m_generation; 129 unsigned short m_generation;
117 mutable unsigned m_pitch : 3; // Pitch 130 mutable unsigned m_pitch : 3; // Pitch
118 mutable bool m_hasLoadingFallback : 1; 131 mutable bool m_hasLoadingFallback : 1;
119
120 friend class Font;
121 }; 132 };
122 133
123 } 134 }
124 135
125 #endif 136 #endif
OLDNEW
« no previous file with comments | « Source/platform/fonts/Font.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698