Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: components/font_service/public/cpp/font_loader.h

Issue 1674903003: Extract shell methods from ApplicationImpl into a base class, and pass this to Initialize() instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojom
Patch Set: . Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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;
22 namespace shell {
23 namespace mojom {
24 class Shell; 21 class Shell;
25 } 22 }
26 }
27 }
28 23
29 namespace font_service { 24 namespace font_service {
30 namespace internal { 25 namespace internal {
31 class FontServiceThread; 26 class FontServiceThread;
32 } 27 }
33 28
34 // 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
35 // 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
36 // requirements) may be called on any thread. (Because of this restriction, 31 // requirements) may be called on any thread. (Because of this restriction,
37 // also see the FontServiceThread class.) 32 // also see the FontServiceThread class.)
38 // 33 //
39 // 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
40 class FontLoader : public SkFontConfigInterface, 35 class FontLoader : public SkFontConfigInterface,
41 public internal::MappedFontFile::Observer { 36 public internal::MappedFontFile::Observer {
42 public: 37 public:
43 explicit FontLoader(mojo::shell::mojom::Shell* shell); 38 explicit FontLoader(mojo::Shell* shell);
44 explicit FontLoader(mojo::ApplicationImpl* application_impl);
45 ~FontLoader() override; 39 ~FontLoader() override;
46 40
47 // Shuts down the background thread. 41 // Shuts down the background thread.
48 void Shutdown(); 42 void Shutdown();
49 43
50 // SkFontConfigInterface: 44 // SkFontConfigInterface:
51 bool matchFamilyName(const char family_name[], 45 bool matchFamilyName(const char family_name[],
52 SkTypeface::Style requested, 46 SkTypeface::Style requested,
53 FontIdentity* out_font_identifier, 47 FontIdentity* out_font_identifier,
54 SkString* out_family_name, 48 SkString* out_family_name,
(...skipping 15 matching lines...) Expand all
70 64
71 // 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.
72 base::hash_map<uint32_t, internal::MappedFontFile*> mapped_font_files_; 66 base::hash_map<uint32_t, internal::MappedFontFile*> mapped_font_files_;
73 67
74 DISALLOW_COPY_AND_ASSIGN(FontLoader); 68 DISALLOW_COPY_AND_ASSIGN(FontLoader);
75 }; 69 };
76 70
77 } // namespace font_service 71 } // namespace font_service
78 72
79 #endif // COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_LOADER_H_ 73 #endif // COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_LOADER_H_
OLDNEW
« no previous file with comments | « components/font_service/font_service_app.cc ('k') | components/font_service/public/cpp/font_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698