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/mru_cache.h" | 9 #include "base/containers/mru_cache.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 #include "skia/ext/refptr.h" | 12 #include "third_party/skia/include/core/SkRefCnt.h" |
13 #include "third_party/skia/include/core/SkStream.h" | 13 #include "third_party/skia/include/core/SkStream.h" |
14 #include "third_party/skia/include/core/SkTypeface.h" | 14 #include "third_party/skia/include/core/SkTypeface.h" |
15 #include "third_party/skia/include/ports/SkFontConfigInterface.h" | 15 #include "third_party/skia/include/ports/SkFontConfigInterface.h" |
16 | 16 |
17 #include <stddef.h> | 17 #include <stddef.h> |
18 | 18 |
19 #include <string> | 19 #include <string> |
20 | 20 |
21 class SkString; | 21 class SkString; |
22 | 22 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 const int fd_; | 64 const int fd_; |
65 // Lock preventing multiple threads from creating a typeface and removing | 65 // Lock preventing multiple threads from creating a typeface and removing |
66 // an element from |mapped_typefaces_| map at the same time. | 66 // an element from |mapped_typefaces_| map at the same time. |
67 base::Lock lock_; | 67 base::Lock lock_; |
68 // Practically, this hash_map definition means that we re-map the same font | 68 // Practically, this hash_map definition means that we re-map the same font |
69 // file multiple times if we receive createTypeface requests for multiple | 69 // file multiple times if we receive createTypeface requests for multiple |
70 // ttc-indices or styles but the same fontconfig interface id. Since the usage | 70 // ttc-indices or styles but the same fontconfig interface id. Since the usage |
71 // frequency of ttc indices is very low, and style is not used by clients of | 71 // frequency of ttc indices is very low, and style is not used by clients of |
72 // this API, this seems okay. | 72 // this API, this seems okay. |
73 base::HashingMRUCache<FontIdentity, | 73 base::HashingMRUCache<FontIdentity, |
74 skia::RefPtr<SkTypeface>, | 74 sk_sp<SkTypeface>, |
75 SkFontConfigInterfaceFontIdentityHash> | 75 SkFontConfigInterfaceFontIdentityHash> |
76 mapped_typefaces_; | 76 mapped_typefaces_; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(FontConfigIPC); | 78 DISALLOW_COPY_AND_ASSIGN(FontConfigIPC); |
79 }; | 79 }; |
80 | 80 |
81 } // namespace content | 81 } // namespace content |
82 | 82 |
83 #endif // CONTENT_COMMON_FONT_CONFIG_IPC_LINUX_H_ | 83 #endif // CONTENT_COMMON_FONT_CONFIG_IPC_LINUX_H_ |
OLD | NEW |