OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_LOADER_H_ | 5 #ifndef COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_LOADER_H_ |
6 #define COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_LOADER_H_ | 6 #define COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_LOADER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "components/font_service/public/cpp/mapped_font_file.h" | 14 #include "components/font_service/public/cpp/mapped_font_file.h" |
15 #include "components/font_service/public/interfaces/font_service.mojom.h" | 15 #include "components/font_service/public/interfaces/font_service.mojom.h" |
16 #include "third_party/skia/include/core/SkStream.h" | 16 #include "third_party/skia/include/core/SkStream.h" |
17 #include "third_party/skia/include/core/SkTypeface.h" | 17 #include "third_party/skia/include/core/SkTypeface.h" |
18 #include "third_party/skia/include/ports/SkFontConfigInterface.h" | 18 #include "third_party/skia/include/ports/SkFontConfigInterface.h" |
19 | 19 |
20 namespace shell { | 20 namespace service_manager { |
21 class Connector; | 21 class Connector; |
22 } | 22 } |
23 | 23 |
24 namespace font_service { | 24 namespace font_service { |
25 namespace internal { | 25 namespace internal { |
26 class FontServiceThread; | 26 class FontServiceThread; |
27 } | 27 } |
28 | 28 |
29 // FontConfig implementation for Skia which proxies to the font service to get | 29 // FontConfig implementation for Skia which proxies to the font service to get |
30 // out of the sandbox. This methods of this class (as imposed by blink | 30 // out of the sandbox. This methods of this class (as imposed by blink |
31 // requirements) may be called on any thread. (Because of this restriction, | 31 // requirements) may be called on any thread. (Because of this restriction, |
32 // also see the FontServiceThread class.) | 32 // also see the FontServiceThread class.) |
33 // | 33 // |
34 // This is the mojo equivalent to content/common/font_config_ipc_linux.h | 34 // This is the mojo equivalent to content/common/font_config_ipc_linux.h |
35 class FontLoader : public SkFontConfigInterface, | 35 class FontLoader : public SkFontConfigInterface, |
36 public internal::MappedFontFile::Observer { | 36 public internal::MappedFontFile::Observer { |
37 public: | 37 public: |
38 explicit FontLoader(shell::Connector* connector); | 38 explicit FontLoader(service_manager::Connector* connector); |
39 ~FontLoader() override; | 39 ~FontLoader() override; |
40 | 40 |
41 // Shuts down the background thread. | 41 // Shuts down the background thread. |
42 void Shutdown(); | 42 void Shutdown(); |
43 | 43 |
44 // SkFontConfigInterface: | 44 // SkFontConfigInterface: |
45 bool matchFamilyName(const char family_name[], | 45 bool matchFamilyName(const char family_name[], |
46 SkFontStyle requested, | 46 SkFontStyle requested, |
47 FontIdentity* out_font_identifier, | 47 FontIdentity* out_font_identifier, |
48 SkString* out_family_name, | 48 SkString* out_family_name, |
(...skipping 15 matching lines...) Expand all Loading... |
64 | 64 |
65 // Maps font identity ID to the memory-mapped file with font data. | 65 // Maps font identity ID to the memory-mapped file with font data. |
66 base::hash_map<uint32_t, internal::MappedFontFile*> mapped_font_files_; | 66 base::hash_map<uint32_t, internal::MappedFontFile*> mapped_font_files_; |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(FontLoader); | 68 DISALLOW_COPY_AND_ASSIGN(FontLoader); |
69 }; | 69 }; |
70 | 70 |
71 } // namespace font_service | 71 } // namespace font_service |
72 | 72 |
73 #endif // COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_LOADER_H_ | 73 #endif // COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_LOADER_H_ |
OLD | NEW |