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 mojo { | 20 namespace mojo { |
21 class ApplicationImpl; | 21 class ApplicationImpl; |
| 22 namespace shell { |
| 23 namespace mojom { |
22 class Shell; | 24 class Shell; |
23 } | 25 } |
| 26 } |
| 27 } |
24 | 28 |
25 namespace font_service { | 29 namespace font_service { |
26 namespace internal { | 30 namespace internal { |
27 class FontServiceThread; | 31 class FontServiceThread; |
28 } | 32 } |
29 | 33 |
30 // FontConfig implementation for Skia which proxies to the font service to get | 34 // FontConfig implementation for Skia which proxies to the font service to get |
31 // out of the sandbox. This methods of this class (as imposed by blink | 35 // out of the sandbox. This methods of this class (as imposed by blink |
32 // requirements) may be called on any thread. (Because of this restriction, | 36 // requirements) may be called on any thread. (Because of this restriction, |
33 // also see the FontServiceThread class.) | 37 // also see the FontServiceThread class.) |
34 // | 38 // |
35 // This is the mojo equivalent to content/common/font_config_ipc_linux.h | 39 // This is the mojo equivalent to content/common/font_config_ipc_linux.h |
36 class FontLoader : public SkFontConfigInterface, | 40 class FontLoader : public SkFontConfigInterface, |
37 public internal::MappedFontFile::Observer { | 41 public internal::MappedFontFile::Observer { |
38 public: | 42 public: |
39 explicit FontLoader(mojo::Shell* shell); | 43 explicit FontLoader(mojo::shell::mojom::Shell* shell); |
40 explicit FontLoader(mojo::ApplicationImpl* application_impl); | 44 explicit FontLoader(mojo::ApplicationImpl* application_impl); |
41 ~FontLoader() override; | 45 ~FontLoader() override; |
42 | 46 |
43 // Shuts down the background thread. | 47 // Shuts down the background thread. |
44 void Shutdown(); | 48 void Shutdown(); |
45 | 49 |
46 // SkFontConfigInterface: | 50 // SkFontConfigInterface: |
47 bool matchFamilyName(const char family_name[], | 51 bool matchFamilyName(const char family_name[], |
48 SkTypeface::Style requested, | 52 SkTypeface::Style requested, |
49 FontIdentity* out_font_identifier, | 53 FontIdentity* out_font_identifier, |
(...skipping 16 matching lines...) Expand all Loading... |
66 | 70 |
67 // Maps font identity ID to the memory-mapped file with font data. | 71 // Maps font identity ID to the memory-mapped file with font data. |
68 base::hash_map<uint32_t, internal::MappedFontFile*> mapped_font_files_; | 72 base::hash_map<uint32_t, internal::MappedFontFile*> mapped_font_files_; |
69 | 73 |
70 DISALLOW_COPY_AND_ASSIGN(FontLoader); | 74 DISALLOW_COPY_AND_ASSIGN(FontLoader); |
71 }; | 75 }; |
72 | 76 |
73 } // namespace font_service | 77 } // namespace font_service |
74 | 78 |
75 #endif // COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_LOADER_H_ | 79 #endif // COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_LOADER_H_ |
OLD | NEW |