OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #include "chrome/renderer/renderer_sandbox_support_linux.h" | 5 #include "chrome/renderer/renderer_sandbox_support_linux.h" |
6 | 6 |
7 #include <sys/stat.h> | 7 #include <sys/stat.h> |
8 | 8 |
9 #include "base/eintr_wrapper.h" | 9 #include "base/eintr_wrapper.h" |
10 #include "base/global_descriptors_posix.h" | 10 #include "base/global_descriptors_posix.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 reply.ReadInt(&pickle_iter, &useSubpixel)) { | 71 reply.ReadInt(&pickle_iter, &useSubpixel)) { |
72 out->useBitmaps = useBitmaps; | 72 out->useBitmaps = useBitmaps; |
73 out->useAutoHint = useAutoHint; | 73 out->useAutoHint = useAutoHint; |
74 out->useHinting = useHinting; | 74 out->useHinting = useHinting; |
75 out->hintStyle = hintStyle; | 75 out->hintStyle = hintStyle; |
76 out->useAntiAlias = useAntiAlias; | 76 out->useAntiAlias = useAntiAlias; |
77 out->useSubpixel = useSubpixel; | 77 out->useSubpixel = useSubpixel; |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 int MakeSharedMemorySegmentViaIPC(size_t length) { | 81 int MakeSharedMemorySegmentViaIPC(size_t length, bool executable) { |
82 Pickle request; | 82 Pickle request; |
83 request.WriteInt(LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT); | 83 request.WriteInt(LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT); |
84 request.WriteUInt32(length); | 84 request.WriteUInt32(length); |
85 uint8_t reply_buf[10]; | 85 uint8_t reply_buf[10]; |
86 int result_fd; | 86 int result_fd; |
87 ssize_t result = base::SendRecvMsg(GetSandboxFD(), | 87 ssize_t result = base::SendRecvMsg(GetSandboxFD(), |
88 reply_buf, sizeof(reply_buf), | 88 reply_buf, sizeof(reply_buf), |
89 &result_fd, request); | 89 &result_fd, request); |
90 if (result == -1) | 90 if (result == -1) |
91 return -1; | 91 return -1; |
92 return result_fd; | 92 return result_fd; |
93 } | 93 } |
94 | 94 |
95 int MakeSharedMemorySegmentViaIPCExecutable(size_t length, bool executable) { | |
96 return MakeSharedMemorySegmentViaIPC(length); | |
97 } | |
98 | |
99 int MatchFontWithFallback(const std::string& face, bool bold, | 95 int MatchFontWithFallback(const std::string& face, bool bold, |
100 bool italic, int charset) { | 96 bool italic, int charset) { |
101 Pickle request; | 97 Pickle request; |
102 request.WriteInt(LinuxSandbox::METHOD_MATCH_WITH_FALLBACK); | 98 request.WriteInt(LinuxSandbox::METHOD_MATCH_WITH_FALLBACK); |
103 request.WriteString(face); | 99 request.WriteString(face); |
104 request.WriteBool(bold); | 100 request.WriteBool(bold); |
105 request.WriteBool(italic); | 101 request.WriteBool(italic); |
106 request.WriteUInt32(charset); | 102 request.WriteUInt32(charset); |
107 uint8_t reply_buf[64]; | 103 uint8_t reply_buf[64]; |
108 int fd = -1; | 104 int fd = -1; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 178 |
183 *output_length = length; | 179 *output_length = length; |
184 n = HANDLE_EINTR(pread(fd, output, length, offset)); | 180 n = HANDLE_EINTR(pread(fd, output, length, offset)); |
185 if (n != static_cast<ssize_t>(length)) | 181 if (n != static_cast<ssize_t>(length)) |
186 return false; | 182 return false; |
187 | 183 |
188 return true; | 184 return true; |
189 } | 185 } |
190 | 186 |
191 } // namespace render_sandbox_support | 187 } // namespace render_sandbox_support |
OLD | NEW |