OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_COMMON_DWRITE_FONT_PLATFORM_WIN_H_ | 5 #ifndef CONTENT_COMMON_DWRITE_FONT_PLATFORM_WIN_H_ |
6 #define CONTENT_COMMON_DWRITE_FONT_PLATFORM_WIN_H_ | 6 #define CONTENT_COMMON_DWRITE_FONT_PLATFORM_WIN_H_ |
7 | 7 |
8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 | 10 |
11 struct IDWriteFactory; | 11 struct IDWriteFactory; |
12 struct IDWriteFontCollection; | 12 struct IDWriteFontCollection; |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
| 16 // This is the shared section that is used between browser and renderer for |
| 17 // loading font cache. Section name is suffixed with browser process id so that |
| 18 // multiple instance chrome scenario works fine. |
| 19 CONTENT_EXPORT extern const char kFontCacheSharedSectionName[]; |
| 20 |
16 // Function returns custom font collection in terms of IDWriteFontCollection. | 21 // Function returns custom font collection in terms of IDWriteFontCollection. |
17 // This function maintains singleton instance of font collection and returns | 22 // This function maintains singleton instance of font collection and returns |
18 // it on repeated calls. | 23 // it on repeated calls. |
19 CONTENT_EXPORT IDWriteFontCollection* GetCustomFontCollection( | 24 CONTENT_EXPORT IDWriteFontCollection* GetCustomFontCollection( |
20 IDWriteFactory* factory); | 25 IDWriteFactory* factory); |
21 | 26 |
22 // Build and load is to accomplish both tasks of creating a font cache within | 27 // Builds static font cache. As this function need to iterate through all |
23 // specified file and then loading it, where loading means creating | |
24 // readonly shared memory mapping. As this function need to iterate through all | |
25 // available fonts in the system, it may take a while. | 28 // available fonts in the system, it may take a while. |
26 CONTENT_EXPORT bool BuildAndLoadFontCache(const base::FilePath& file); | 29 CONTENT_EXPORT bool BuildFontCache(const base::FilePath& file); |
27 | 30 |
28 // Loads font cache from file. This is supposed to be used from browser | 31 // Loads font cache from file. This is supposed to be used from browser |
29 // side where loading means creating readonly shared memory file mapping so that | 32 // side where loading means creating readonly shared memory file mapping so that |
30 // renderers can read from it. | 33 // renderers can read from it. |
31 CONTENT_EXPORT bool LoadFontCache(const base::FilePath& path); | 34 CONTENT_EXPORT bool LoadFontCache(const base::FilePath& path); |
32 | 35 |
33 // Added in header mainly for unittest | 36 // Added in header mainly for unittest |
34 CONTENT_EXPORT bool ValidateFontCacheFile(base::File* file); | 37 CONTENT_EXPORT bool ValidateFontCacheFile(base::File* file); |
35 | 38 |
36 } // namespace content | 39 } // namespace content |
37 | 40 |
38 #endif // CONTENT_COMMON_DWRITE_FONT_PLATFORM_WIN_H_ | 41 #endif // CONTENT_COMMON_DWRITE_FONT_PLATFORM_WIN_H_ |
OLD | NEW |