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/zygote/zygote_linux.h" | 5 #include "content/zygote/zygote_linux.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 if (use_helper) { | 313 if (use_helper) { |
314 std::vector<int> fds; | 314 std::vector<int> fds; |
315 int ipc_channel_fd = LookUpFd(fd_mapping, kPrimaryIPCChannel); | 315 int ipc_channel_fd = LookUpFd(fd_mapping, kPrimaryIPCChannel); |
316 if (ipc_channel_fd < 0) { | 316 if (ipc_channel_fd < 0) { |
317 DLOG(ERROR) << "Failed to find kPrimaryIPCChannel in FD mapping"; | 317 DLOG(ERROR) << "Failed to find kPrimaryIPCChannel in FD mapping"; |
318 goto error; | 318 goto error; |
319 } | 319 } |
320 fds.push_back(ipc_channel_fd); // kBrowserFDIndex | 320 fds.push_back(ipc_channel_fd); // kBrowserFDIndex |
321 fds.push_back(dummy_fd); // kDummyFDIndex | 321 fds.push_back(dummy_fd); // kDummyFDIndex |
322 fds.push_back(pipe_fds[0]); // kParentFDIndex | 322 fds.push_back(pipe_fds[0]); // kParentFDIndex |
323 pid = helper_->Fork(fds); | 323 pid = helper_->Fork(process_type, fds); |
324 } else { | 324 } else { |
325 pid = fork(); | 325 pid = fork(); |
326 } | 326 } |
327 if (pid < 0) { | 327 if (pid < 0) { |
328 goto error; | 328 goto error; |
329 } else if (pid == 0) { | 329 } else if (pid == 0) { |
330 // In the child process. | 330 // In the child process. |
331 close(pipe_fds[1]); | 331 close(pipe_fds[1]); |
332 base::ProcessId real_pid; | 332 base::ProcessId real_pid; |
333 // Wait until the parent process has discovered our PID. We | 333 // Wait until the parent process has discovered our PID. We |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 PickleIterator iter) { | 543 PickleIterator iter) { |
544 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != | 544 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != |
545 sizeof(sandbox_flags_)) { | 545 sizeof(sandbox_flags_)) { |
546 PLOG(ERROR) << "write"; | 546 PLOG(ERROR) << "write"; |
547 } | 547 } |
548 | 548 |
549 return false; | 549 return false; |
550 } | 550 } |
551 | 551 |
552 } // namespace content | 552 } // namespace content |
OLD | NEW |