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 #ifndef CONTENT_COMMON_FONT_CONFIG_IPC_LINUX_H_ | 5 #ifndef CONTENT_COMMON_FONT_CONFIG_IPC_LINUX_H_ |
6 #define CONTENT_COMMON_FONT_CONFIG_IPC_LINUX_H_ | 6 #define CONTENT_COMMON_FONT_CONFIG_IPC_LINUX_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/synchronization/lock.h" |
9 #include "third_party/skia/include/core/SkStream.h" | 11 #include "third_party/skia/include/core/SkStream.h" |
10 #include "third_party/skia/include/core/SkTypeface.h" | 12 #include "third_party/skia/include/core/SkTypeface.h" |
11 #include "third_party/skia/include/ports/SkFontConfigInterface.h" | 13 #include "third_party/skia/include/ports/SkFontConfigInterface.h" |
12 | 14 |
13 #include <string> | 15 #include <string> |
14 | 16 |
15 class SkString; | 17 class SkString; |
16 | 18 |
17 namespace content { | 19 namespace content { |
18 | 20 |
(...skipping 15 matching lines...) Expand all Loading... |
34 enum Method { | 36 enum Method { |
35 METHOD_MATCH = 0, | 37 METHOD_MATCH = 0, |
36 METHOD_OPEN = 1, | 38 METHOD_OPEN = 1, |
37 }; | 39 }; |
38 | 40 |
39 enum { | 41 enum { |
40 kMaxFontFamilyLength = 2048 | 42 kMaxFontFamilyLength = 2048 |
41 }; | 43 }; |
42 | 44 |
43 private: | 45 private: |
| 46 class MappedFontFile; |
| 47 |
| 48 // Removes |mapped_font_file| from |mapped_font_files_|. |
| 49 // Does not delete the passed-in object. |
| 50 void RemoveMappedFontFile(MappedFontFile* mapped_font_file); |
| 51 |
44 const int fd_; | 52 const int fd_; |
| 53 // Lock preventing multiple threads from opening font file and accessing |
| 54 // |mapped_font_files_| map at the same time. |
| 55 base::Lock lock_; |
| 56 // Maps font identity ID to the memory-mapped file with font data. |
| 57 base::hash_map<uint32_t, MappedFontFile*> mapped_font_files_; |
45 }; | 58 }; |
46 | 59 |
47 } // namespace content | 60 } // namespace content |
48 | 61 |
49 #endif // CONTENT_COMMON_FONT_CONFIG_IPC_LINUX_H_ | 62 #endif // CONTENT_COMMON_FONT_CONFIG_IPC_LINUX_H_ |
OLD | NEW |