OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/gfx/font_render_params.h" | 5 #include "ui/gfx/font_render_params.h" |
6 | 6 |
| 7 #include <fontconfig/fontconfig.h> |
| 8 |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/containers/mru_cache.h" | 10 #include "base/containers/mru_cache.h" |
9 #include "base/hash.h" | 11 #include "base/hash.h" |
10 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
11 #include "base/logging.h" | 13 #include "base/logging.h" |
12 #include "base/macros.h" | 14 #include "base/macros.h" |
13 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
14 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
15 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
16 #include "ui/gfx/font.h" | 18 #include "ui/gfx/font.h" |
17 #include "ui/gfx/linux_font_delegate.h" | 19 #include "ui/gfx/linux_font_delegate.h" |
18 #include "ui/gfx/switches.h" | 20 #include "ui/gfx/switches.h" |
19 | 21 |
20 #include <fontconfig/fontconfig.h> | |
21 | |
22 namespace gfx { | 22 namespace gfx { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // Keyed by hashes of FontRenderParamQuery structs from | 26 // Keyed by hashes of FontRenderParamQuery structs from |
27 // HashFontRenderParamsQuery(). | 27 // HashFontRenderParamsQuery(). |
28 typedef base::MRUCache<uint32, FontRenderParams> Cache; | 28 typedef base::MRUCache<uint32, FontRenderParams> Cache; |
29 | 29 |
30 // Number of recent GetFontRenderParams() results to cache. | 30 // Number of recent GetFontRenderParams() results to cache. |
31 const size_t kCacheSize = 20; | 31 const size_t kCacheSize = 20; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 return params; | 211 return params; |
212 } | 212 } |
213 | 213 |
214 void ClearFontRenderParamsCacheForTest() { | 214 void ClearFontRenderParamsCacheForTest() { |
215 SynchronizedCache* synchronized_cache = g_synchronized_cache.Pointer(); | 215 SynchronizedCache* synchronized_cache = g_synchronized_cache.Pointer(); |
216 base::AutoLock lock(synchronized_cache->lock); | 216 base::AutoLock lock(synchronized_cache->lock); |
217 synchronized_cache->cache.Clear(); | 217 synchronized_cache->cache.Clear(); |
218 } | 218 } |
219 | 219 |
220 } // namespace gfx | 220 } // namespace gfx |
OLD | NEW |