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

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

Issue 1280043003: Sandbox html_viewer on Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update DEPS for the new dependency. 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_FONT_SERVICE_PUBLIC_CPP_MAPPED_FONT_FILE_H_
6 #define COMPONENTS_FONT_SERVICE_PUBLIC_CPP_MAPPED_FONT_FILE_H_
7
8 #include "base/files/file.h"
9 #include "base/files/memory_mapped_file.h"
10 #include "base/memory/ref_counted.h"
11 #include "third_party/skia/include/core/SkStream.h"
12
13 namespace font_service {
14 namespace internal {
15
16 // Owns the memory of the mmaped file that we get back from the font_service.
17 //
18 // This class is an implementation detail and shouldn't be used by consumers.
19 class MappedFontFile : public base::RefCountedThreadSafe<MappedFontFile> {
20 public:
21 class Observer {
22 public:
23 ~Observer() {}
24
25 // Called when a MappedFontFile is destroyed.
26 virtual void OnMappedFontFileDestroyed(MappedFontFile* f) = 0;
27 };
28
29 explicit MappedFontFile(uint32_t font_id);
30
31 uint32_t font_id() const { return font_id_; }
32
33 void set_observer(Observer* observer) { observer_ = observer; }
34
35 bool Initialize(base::File file);
36
37 SkMemoryStream* CreateMemoryStream();
38
39 private:
40 friend class base::RefCountedThreadSafe<MappedFontFile>;
41
42 ~MappedFontFile();
43
44 static void ReleaseProc(const void* ptr, void* context);
45
46 uint32_t font_id_;
47 base::MemoryMappedFile mapped_font_file_;
48 Observer* observer_;
49 };
50
51 } // namespace internal
52 } // namespace font_service
53
54 #endif // COMPONENTS_FONT_SERVICE_PUBLIC_CPP_MAPPED_FONT_FILE_H_
OLDNEW
« no previous file with comments | « components/font_service/public/cpp/font_service_thread.cc ('k') | components/font_service/public/cpp/mapped_font_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698