OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_LINUX_H_ | 5 #ifndef CONTENT_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_LINUX_H_ |
6 #define CONTENT_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_LINUX_H_ | 6 #define CONTENT_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_LINUX_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
| 13 #include "content/common/content_export.h" |
| 14 |
13 namespace WebKit { | 15 namespace WebKit { |
14 struct WebFontRenderStyle; | 16 struct WebFontRenderStyle; |
15 } | 17 } |
16 | 18 |
17 namespace child_process_sandbox_support { | 19 namespace child_process_sandbox_support { |
18 | 20 |
19 // Return a font family which provides glyphs for the Unicode code points | 21 // Return a font family which provides glyphs for the Unicode code points |
20 // specified by |utf16| | 22 // specified by |utf16| |
21 // utf16: a native-endian UTF16 string | 23 // utf16: a native-endian UTF16 string |
22 // num_utf16: the number of 16-bit words in |utf16| | 24 // num_utf16: the number of 16-bit words in |utf16| |
23 // preferred_locale: preferred locale identifier for the |utf16| | 25 // preferred_locale: preferred locale identifier for the |utf16| |
24 // | 26 // |
25 // Returns: the font family or an empty string if the request could not be | 27 // Returns: the font family or an empty string if the request could not be |
26 // satisfied. | 28 // satisfied. |
27 std::string getFontFamilyForCharacters(const uint16_t* utf16, | 29 std::string getFontFamilyForCharacters(const uint16_t* utf16, |
28 size_t num_utf16, | 30 size_t num_utf16, |
29 const char* preferred_locale); | 31 const char* preferred_locale); |
30 | 32 |
31 void getRenderStyleForStrike(const char* family, int sizeAndStyle, | 33 void getRenderStyleForStrike(const char* family, int sizeAndStyle, |
32 WebKit::WebFontRenderStyle* out); | 34 WebKit::WebFontRenderStyle* out); |
33 | 35 |
34 // Returns a file descriptor for a shared memory segment. | 36 // Returns a file descriptor for a shared memory segment. |
35 // The second argument is ignored because SHM segments are always | 37 // The second argument is ignored because SHM segments are always |
36 // mappable with PROT_EXEC on Linux. | 38 // mappable with PROT_EXEC on Linux. |
37 int MakeSharedMemorySegmentViaIPC(size_t length, bool executable); | 39 CONTENT_EXPORT int MakeSharedMemorySegmentViaIPC(size_t length, |
| 40 bool executable); |
38 | 41 |
39 // Return a read-only file descriptor to the font which best matches the given | 42 // Return a read-only file descriptor to the font which best matches the given |
40 // properties or -1 on failure. | 43 // properties or -1 on failure. |
41 // charset: specifies the language(s) that the font must cover. See | 44 // charset: specifies the language(s) that the font must cover. See |
42 // render_sandbox_host_linux.cc for more information. | 45 // render_sandbox_host_linux.cc for more information. |
43 int MatchFontWithFallback(const std::string& face, bool bold, | 46 CONTENT_EXPORT int MatchFontWithFallback(const std::string& face, bool bold, |
44 bool italic, int charset); | 47 bool italic, int charset); |
45 | 48 |
46 // GetFontTable loads a specified font table from an open SFNT file. | 49 // GetFontTable loads a specified font table from an open SFNT file. |
47 // fd: a file descriptor to the SFNT file. The position doesn't matter. | 50 // fd: a file descriptor to the SFNT file. The position doesn't matter. |
48 // table: the table in *big-endian* format, or 0 for the whole font file. | 51 // table: the table in *big-endian* format, or 0 for the whole font file. |
49 // output: a buffer of size output_length that gets the data. can be 0, in | 52 // output: a buffer of size output_length that gets the data. can be 0, in |
50 // which case output_length will be set to the required size in bytes. | 53 // which case output_length will be set to the required size in bytes. |
51 // output_length: size of output, if it's not 0. | 54 // output_length: size of output, if it's not 0. |
52 // | 55 // |
53 // returns: true on success. | 56 // returns: true on success. |
54 bool GetFontTable(int fd, uint32_t table, uint8_t* output, | 57 CONTENT_EXPORT bool GetFontTable(int fd, uint32_t table, uint8_t* output, |
55 size_t* output_length); | 58 size_t* output_length); |
56 | 59 |
57 }; // namespace child_process_sandbox_support | 60 }; // namespace child_process_sandbox_support |
58 | 61 |
59 #endif // CONTENT_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_LINUX_H_ | 62 #endif // CONTENT_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_LINUX_H_ |
OLD | NEW |