OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/renderer_host/render_sandbox_host_linux.h" | 5 #include "chrome/browser/renderer_host/render_sandbox_host_linux.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <unistd.h> | 8 #include <unistd.h> |
9 #include <sys/uio.h> | 9 #include <sys/uio.h> |
10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 CHECK(socketpair(AF_UNIX, SOCK_DGRAM, 0, fds) == 0); | 288 CHECK(socketpair(AF_UNIX, SOCK_DGRAM, 0, fds) == 0); |
289 | 289 |
290 renderer_socket_ = fds[0]; | 290 renderer_socket_ = fds[0]; |
291 const int browser_socket = fds[1]; | 291 const int browser_socket = fds[1]; |
292 | 292 |
293 int pipefds[2]; | 293 int pipefds[2]; |
294 CHECK(0 == pipe(pipefds)); | 294 CHECK(0 == pipe(pipefds)); |
295 const int child_lifeline_fd = pipefds[0]; | 295 const int child_lifeline_fd = pipefds[0]; |
296 childs_lifeline_fd_ = pipefds[1]; | 296 childs_lifeline_fd_ = pipefds[1]; |
297 | 297 |
298 const pid_t child = fork(); | 298 pid_ = fork(); |
299 if (child == 0) { | 299 if (pid_ == 0) { |
300 SandboxIPCProcess handler(child_lifeline_fd, browser_socket); | 300 SandboxIPCProcess handler(child_lifeline_fd, browser_socket); |
301 handler.Run(); | 301 handler.Run(); |
302 _exit(0); | 302 _exit(0); |
303 } | 303 } |
304 } | 304 } |
305 | 305 |
306 RenderSandboxHostLinux::~RenderSandboxHostLinux() { | 306 RenderSandboxHostLinux::~RenderSandboxHostLinux() { |
307 HANDLE_EINTR(close(renderer_socket_)); | 307 HANDLE_EINTR(close(renderer_socket_)); |
308 HANDLE_EINTR(close(childs_lifeline_fd_)); | 308 HANDLE_EINTR(close(childs_lifeline_fd_)); |
309 } | 309 } |
OLD | NEW |