| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/common/child_process_sandbox_support_impl_linux.h" | 5 #include "content/common/child_process_sandbox_support_impl_linux.h" |
| 6 | 6 |
| 7 #include <sys/stat.h> | 7 #include <sys/stat.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 const char* preferred_locale, | 26 const char* preferred_locale, |
| 27 blink::WebFallbackFont* fallbackFont) { | 27 blink::WebFallbackFont* fallbackFont) { |
| 28 TRACE_EVENT0("sandbox_ipc", "GetFontFamilyForCharacter"); | 28 TRACE_EVENT0("sandbox_ipc", "GetFontFamilyForCharacter"); |
| 29 | 29 |
| 30 Pickle request; | 30 Pickle request; |
| 31 request.WriteInt(LinuxSandbox::METHOD_GET_FALLBACK_FONT_FOR_CHAR); | 31 request.WriteInt(LinuxSandbox::METHOD_GET_FALLBACK_FONT_FOR_CHAR); |
| 32 request.WriteInt(character); | 32 request.WriteInt(character); |
| 33 request.WriteString(preferred_locale); | 33 request.WriteString(preferred_locale); |
| 34 | 34 |
| 35 uint8_t buf[512]; | 35 uint8_t buf[512]; |
| 36 const ssize_t n = UnixDomainSocket::SendRecvMsg(GetSandboxFD(), buf, | 36 const ssize_t n = base::UnixDomainSocket::SendRecvMsg( |
| 37 sizeof(buf), NULL, request); | 37 GetSandboxFD(), buf, sizeof(buf), NULL, request); |
| 38 | 38 |
| 39 std::string family_name; | 39 std::string family_name; |
| 40 std::string filename; | 40 std::string filename; |
| 41 int fontconfigInterfaceId = 0; | 41 int fontconfigInterfaceId = 0; |
| 42 int ttcIndex = 0; | 42 int ttcIndex = 0; |
| 43 bool isBold = false; | 43 bool isBold = false; |
| 44 bool isItalic = false; | 44 bool isItalic = false; |
| 45 if (n != -1) { | 45 if (n != -1) { |
| 46 Pickle reply(reinterpret_cast<char*>(buf), n); | 46 Pickle reply(reinterpret_cast<char*>(buf), n); |
| 47 PickleIterator pickle_iter(reply); | 47 PickleIterator pickle_iter(reply); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 78 return; | 78 return; |
| 79 | 79 |
| 80 Pickle request; | 80 Pickle request; |
| 81 request.WriteInt(LinuxSandbox::METHOD_GET_STYLE_FOR_STRIKE); | 81 request.WriteInt(LinuxSandbox::METHOD_GET_STYLE_FOR_STRIKE); |
| 82 request.WriteString(family); | 82 request.WriteString(family); |
| 83 request.WriteBool(bold); | 83 request.WriteBool(bold); |
| 84 request.WriteBool(italic); | 84 request.WriteBool(italic); |
| 85 request.WriteUInt16(pixel_size); | 85 request.WriteUInt16(pixel_size); |
| 86 | 86 |
| 87 uint8_t buf[512]; | 87 uint8_t buf[512]; |
| 88 const ssize_t n = UnixDomainSocket::SendRecvMsg(GetSandboxFD(), buf, | 88 const ssize_t n = base::UnixDomainSocket::SendRecvMsg( |
| 89 sizeof(buf), NULL, request); | 89 GetSandboxFD(), buf, sizeof(buf), NULL, request); |
| 90 if (n == -1) | 90 if (n == -1) |
| 91 return; | 91 return; |
| 92 | 92 |
| 93 Pickle reply(reinterpret_cast<char*>(buf), n); | 93 Pickle reply(reinterpret_cast<char*>(buf), n); |
| 94 PickleIterator pickle_iter(reply); | 94 PickleIterator pickle_iter(reply); |
| 95 int use_bitmaps, use_autohint, use_hinting, hint_style, use_antialias; | 95 int use_bitmaps, use_autohint, use_hinting, hint_style, use_antialias; |
| 96 int use_subpixel_rendering, use_subpixel_positioning; | 96 int use_subpixel_rendering, use_subpixel_positioning; |
| 97 if (pickle_iter.ReadInt(&use_bitmaps) && | 97 if (pickle_iter.ReadInt(&use_bitmaps) && |
| 98 pickle_iter.ReadInt(&use_autohint) && | 98 pickle_iter.ReadInt(&use_autohint) && |
| 99 pickle_iter.ReadInt(&use_hinting) && | 99 pickle_iter.ReadInt(&use_hinting) && |
| (...skipping 20 matching lines...) Expand all Loading... |
| 120 | 120 |
| 121 Pickle request; | 121 Pickle request; |
| 122 request.WriteInt(LinuxSandbox::METHOD_MATCH_WITH_FALLBACK); | 122 request.WriteInt(LinuxSandbox::METHOD_MATCH_WITH_FALLBACK); |
| 123 request.WriteString(face); | 123 request.WriteString(face); |
| 124 request.WriteBool(bold); | 124 request.WriteBool(bold); |
| 125 request.WriteBool(italic); | 125 request.WriteBool(italic); |
| 126 request.WriteUInt32(charset); | 126 request.WriteUInt32(charset); |
| 127 request.WriteUInt32(fallback_family); | 127 request.WriteUInt32(fallback_family); |
| 128 uint8_t reply_buf[64]; | 128 uint8_t reply_buf[64]; |
| 129 int fd = -1; | 129 int fd = -1; |
| 130 UnixDomainSocket::SendRecvMsg(GetSandboxFD(), reply_buf, sizeof(reply_buf), | 130 base::UnixDomainSocket::SendRecvMsg( |
| 131 &fd, request); | 131 GetSandboxFD(), reply_buf, sizeof(reply_buf), &fd, request); |
| 132 return fd; | 132 return fd; |
| 133 } | 133 } |
| 134 | 134 |
| 135 bool GetFontTable(int fd, uint32_t table_tag, off_t offset, | 135 bool GetFontTable(int fd, uint32_t table_tag, off_t offset, |
| 136 uint8_t* output, size_t* output_length) { | 136 uint8_t* output, size_t* output_length) { |
| 137 if (offset < 0) | 137 if (offset < 0) |
| 138 return false; | 138 return false; |
| 139 | 139 |
| 140 size_t data_length = 0; // the length of the file data. | 140 size_t data_length = 0; // the length of the file data. |
| 141 off_t data_offset = 0; // the offset of the data in the file. | 141 off_t data_offset = 0; // the offset of the data in the file. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 ssize_t n = HANDLE_EINTR(pread(fd, output, data_length, data_offset)); | 198 ssize_t n = HANDLE_EINTR(pread(fd, output, data_length, data_offset)); |
| 199 if (n != base::checked_cast<ssize_t>(data_length)) | 199 if (n != base::checked_cast<ssize_t>(data_length)) |
| 200 return false; | 200 return false; |
| 201 } | 201 } |
| 202 *output_length = data_length; | 202 *output_length = data_length; |
| 203 | 203 |
| 204 return true; | 204 return true; |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace content | 207 } // namespace content |
| OLD | NEW |