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

Side by Side Diff: content/common/child_process_sandbox_support_impl_linux.cc

Issue 8893009: Move content::MakeSharedMemorySegmentViaIPC into its own file (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minimal dependencies Created 9 years 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 | Annotate | Revision Log
OLDNEW
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 #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 "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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 reply.ReadInt(&pickle_iter, &useSubpixel)) { 80 reply.ReadInt(&pickle_iter, &useSubpixel)) {
81 out->useBitmaps = useBitmaps; 81 out->useBitmaps = useBitmaps;
82 out->useAutoHint = useAutoHint; 82 out->useAutoHint = useAutoHint;
83 out->useHinting = useHinting; 83 out->useHinting = useHinting;
84 out->hintStyle = hintStyle; 84 out->hintStyle = hintStyle;
85 out->useAntiAlias = useAntiAlias; 85 out->useAntiAlias = useAntiAlias;
86 out->useSubpixel = useSubpixel; 86 out->useSubpixel = useSubpixel;
87 } 87 }
88 } 88 }
89 89
90 int MakeSharedMemorySegmentViaIPC(size_t length, bool executable) {
91 Pickle request;
92 request.WriteInt(LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT);
93 request.WriteUInt32(length);
94 request.WriteBool(executable);
95 uint8_t reply_buf[10];
96 int result_fd;
97 ssize_t result = UnixDomainSocket::SendRecvMsg(GetSandboxFD(),
98 reply_buf, sizeof(reply_buf),
99 &result_fd, request);
100 if (result == -1)
101 return -1;
102 return result_fd;
103 }
104
105 int MatchFontWithFallback(const std::string& face, bool bold, 90 int MatchFontWithFallback(const std::string& face, bool bold,
106 bool italic, int charset) { 91 bool italic, int charset) {
107 Pickle request; 92 Pickle request;
108 request.WriteInt(LinuxSandbox::METHOD_MATCH_WITH_FALLBACK); 93 request.WriteInt(LinuxSandbox::METHOD_MATCH_WITH_FALLBACK);
109 request.WriteString(face); 94 request.WriteString(face);
110 request.WriteBool(bold); 95 request.WriteBool(bold);
111 request.WriteBool(italic); 96 request.WriteBool(italic);
112 request.WriteUInt32(charset); 97 request.WriteUInt32(charset);
113 uint8_t reply_buf[64]; 98 uint8_t reply_buf[64];
114 int fd = -1; 99 int fd = -1;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 173
189 *output_length = length; 174 *output_length = length;
190 n = HANDLE_EINTR(pread(fd, output, length, offset)); 175 n = HANDLE_EINTR(pread(fd, output, length, offset));
191 if (n != static_cast<ssize_t>(length)) 176 if (n != static_cast<ssize_t>(length))
192 return false; 177 return false;
193 178
194 return true; 179 return true;
195 } 180 }
196 181
197 } // namespace content 182 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698