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

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

Issue 1282903002: mandoline: Sandbox mojo:browser and mojo:omnibox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch touch ups. Created 5 years, 4 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 "base/containers/hash_tables.h" 8 #include "base/containers/hash_tables.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
11 #include "components/font_service/public/cpp/mapped_font_file.h" 11 #include "components/font_service/public/cpp/mapped_font_file.h"
12 #include "components/font_service/public/interfaces/font_service.mojom.h" 12 #include "components/font_service/public/interfaces/font_service.mojom.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 namespace mojo { 17 namespace mojo {
18 class ApplicationImpl; 18 class ApplicationImpl;
19 class Shell;
19 } 20 }
20 21
21 namespace font_service { 22 namespace font_service {
22 namespace internal { 23 namespace internal {
23 class FontServiceThread; 24 class FontServiceThread;
24 } 25 }
25 26
26 // FontConfig implementation for Skia which proxies to the font service to get 27 // FontConfig implementation for Skia which proxies to the font service to get
27 // out of the sandbox. This methods of this class (as imposed by blink 28 // out of the sandbox. This methods of this class (as imposed by blink
28 // requirements) may be called on any thread. (Because of this restriction, 29 // requirements) may be called on any thread. (Because of this restriction,
29 // also see the FontServiceThread class.) 30 // also see the FontServiceThread class.)
30 // 31 //
31 // This is the mojo equivalent to content/common/font_config_ipc_linux.h 32 // This is the mojo equivalent to content/common/font_config_ipc_linux.h
32 class FontLoader : public SkFontConfigInterface, 33 class FontLoader : public SkFontConfigInterface,
33 public internal::MappedFontFile::Observer { 34 public internal::MappedFontFile::Observer {
34 public: 35 public:
36 explicit FontLoader(mojo::Shell* shell);
35 explicit FontLoader(mojo::ApplicationImpl* application_impl); 37 explicit FontLoader(mojo::ApplicationImpl* application_impl);
36 ~FontLoader() override; 38 ~FontLoader() override;
37 39
38 // SkFontConfigInterface: 40 // SkFontConfigInterface:
39 bool matchFamilyName(const char family_name[], 41 bool matchFamilyName(const char family_name[],
40 SkTypeface::Style requested, 42 SkTypeface::Style requested,
41 FontIdentity* out_font_identifier, 43 FontIdentity* out_font_identifier,
42 SkString* out_family_name, 44 SkString* out_family_name,
43 SkTypeface::Style* out_style) override; 45 SkTypeface::Style* out_style) override;
44 SkStreamAsset* openStream(const FontIdentity& identity) override; 46 SkStreamAsset* openStream(const FontIdentity& identity) override;
(...skipping 13 matching lines...) Expand all
58 60
59 // Maps font identity ID to the memory-mapped file with font data. 61 // Maps font identity ID to the memory-mapped file with font data.
60 base::hash_map<uint32_t, internal::MappedFontFile*> mapped_font_files_; 62 base::hash_map<uint32_t, internal::MappedFontFile*> mapped_font_files_;
61 63
62 DISALLOW_COPY_AND_ASSIGN(FontLoader); 64 DISALLOW_COPY_AND_ASSIGN(FontLoader);
63 }; 65 };
64 66
65 } // namespace font_service 67 } // namespace font_service
66 68
67 #endif // COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_LOADER_H_ 69 #endif // COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_LOADER_H_
OLDNEW
« no previous file with comments | « no previous file | components/font_service/public/cpp/font_loader.cc » ('j') | mandoline/app/core_services_initialization.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698