OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "core/html/canvas/CanvasFontCache.h" | 5 #include "core/html/canvas/CanvasFontCache.h" |
6 | 6 |
7 #include "core/css/parser/CSSParser.h" | 7 #include "core/css/parser/CSSParser.h" |
8 #include "core/css/resolver/StyleResolver.h" | 8 #include "core/css/resolver/StyleResolver.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/style/ComputedStyle.h" | 10 #include "core/style/ComputedStyle.h" |
11 #include "platform/fonts/FontCache.h" | 11 #include "platform/fonts/FontCache.h" |
12 #include "platform/wtf/PtrUtil.h" | 12 #include "platform/wtf/PtrUtil.h" |
13 #include "public/platform/Platform.h" | 13 #include "public/platform/Platform.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 const unsigned CanvasFontCacheMaxFonts = 50; | 17 const unsigned CanvasFontCacheMaxFonts = 50; |
18 const unsigned CanvasFontCacheMaxFontsLowEnd = 5; | 18 const unsigned CanvasFontCacheMaxFontsLowEnd = 5; |
19 const unsigned CanvasFontCacheHardMaxFonts = 250; | 19 const unsigned CanvasFontCacheHardMaxFonts = 250; |
20 const unsigned CanvasFontCacheHardMaxFontsLowEnd = 20; | 20 const unsigned CanvasFontCacheHardMaxFontsLowEnd = 20; |
21 const unsigned CanvasFontCacheHiddenMaxFonts = 1; | 21 const unsigned CanvasFontCacheHiddenMaxFonts = 1; |
22 const int defaultFontSize = 10; | 22 const int defaultFontSize = 10; |
23 const char defaultFontFamily[] = "sans-serif"; | 23 const char defaultFontFamily[] = "sans-serif"; |
24 } | 24 } // namespace |
25 | 25 |
26 namespace blink { | 26 namespace blink { |
27 | 27 |
28 CanvasFontCache::CanvasFontCache(Document& document) | 28 CanvasFontCache::CanvasFontCache(Document& document) |
29 : document_(&document), pruning_scheduled_(false) { | 29 : document_(&document), pruning_scheduled_(false) { |
30 FontFamily font_family; | 30 FontFamily font_family; |
31 font_family.SetFamily(defaultFontFamily); | 31 font_family.SetFamily(defaultFontFamily); |
32 FontDescription default_font_description; | 32 FontDescription default_font_description; |
33 default_font_description.SetFamily(font_family); | 33 default_font_description.SetFamily(font_family); |
34 default_font_description.SetSpecifiedSize(defaultFontSize); | 34 default_font_description.SetSpecifiedSize(defaultFontSize); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 font_lru_list_.clear(); | 153 font_lru_list_.clear(); |
154 fonts_resolved_using_default_style_.clear(); | 154 fonts_resolved_using_default_style_.clear(); |
155 } | 155 } |
156 | 156 |
157 DEFINE_TRACE(CanvasFontCache) { | 157 DEFINE_TRACE(CanvasFontCache) { |
158 visitor->Trace(fetched_fonts_); | 158 visitor->Trace(fetched_fonts_); |
159 visitor->Trace(document_); | 159 visitor->Trace(document_); |
160 } | 160 } |
161 | 161 |
162 } // namespace blink | 162 } // namespace blink |
OLD | NEW |