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 "content/common/font_cache_dispatcher_win.h" | 5 #include "content/common/font_cache_dispatcher_win.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "content/common/child_process_messages.h" | 12 #include "content/common/child_process_messages.h" |
13 | 13 |
| 14 namespace content { |
14 namespace { | 15 namespace { |
15 typedef std::vector<string16> FontNameVector; | 16 typedef std::vector<string16> FontNameVector; |
16 typedef std::map<FontCacheDispatcher*, FontNameVector> DispatcherToFontNames; | 17 typedef std::map<FontCacheDispatcher*, FontNameVector> DispatcherToFontNames; |
17 | 18 |
18 class FontCache { | 19 class FontCache { |
19 public: | 20 public: |
20 static FontCache* GetInstance() { | 21 static FontCache* GetInstance() { |
21 return Singleton<FontCache>::get(); | 22 return Singleton<FontCache>::get(); |
22 } | 23 } |
23 | 24 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // when a font is asked to be cached, we always recreates the font object | 183 // when a font is asked to be cached, we always recreates the font object |
183 // to avoid the case that an in-cache font is swapped out by GDI. | 184 // to avoid the case that an in-cache font is swapped out by GDI. |
184 FontCache::GetInstance()->PreCacheFont(font, this); | 185 FontCache::GetInstance()->PreCacheFont(font, this); |
185 } | 186 } |
186 | 187 |
187 void FontCacheDispatcher::OnReleaseCachedFonts() { | 188 void FontCacheDispatcher::OnReleaseCachedFonts() { |
188 // Release cached fonts that requested from a pid by decrementing the ref | 189 // Release cached fonts that requested from a pid by decrementing the ref |
189 // count. When ref count is zero, the handles are released. | 190 // count. When ref count is zero, the handles are released. |
190 FontCache::GetInstance()->ReleaseCachedFonts(this); | 191 FontCache::GetInstance()->ReleaseCachedFonts(this); |
191 } | 192 } |
| 193 |
| 194 } // namespace content |
OLD | NEW |