| 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 fds.push_back(ipc_channel_fd); // kBrowserFDIndex | 367 fds.push_back(ipc_channel_fd); // kBrowserFDIndex |
| 368 fds.push_back(pid_oracle.get()); // kPIDOracleFDIndex | 368 fds.push_back(pid_oracle.get()); // kPIDOracleFDIndex |
| 369 pid = helper->Fork(process_type, fds, channel_id); | 369 pid = helper->Fork(process_type, fds, channel_id); |
| 370 | 370 |
| 371 // Helpers should never return in the child process. | 371 // Helpers should never return in the child process. |
| 372 CHECK_NE(pid, 0); | 372 CHECK_NE(pid, 0); |
| 373 } else { | 373 } else { |
| 374 CreatePipe(&read_pipe, &write_pipe); | 374 CreatePipe(&read_pipe, &write_pipe); |
| 375 // This is roughly equivalent to a fork(). We are using ForkWithFlags mainly | 375 // This is roughly equivalent to a fork(). We are using ForkWithFlags mainly |
| 376 // to give it some more diverse test coverage. | 376 // to give it some more diverse test coverage. |
| 377 pid = sandbox::ForkWithFlags(SIGCHLD, nullptr, nullptr); | 377 pid = base::ForkWithFlags(SIGCHLD, nullptr, nullptr); |
| 378 } | 378 } |
| 379 | 379 |
| 380 if (pid == 0) { | 380 if (pid == 0) { |
| 381 // In the child process. | 381 // In the child process. |
| 382 write_pipe.reset(); | 382 write_pipe.reset(); |
| 383 | 383 |
| 384 // Ping the PID oracle socket so the browser can find our PID. | 384 // Ping the PID oracle socket so the browser can find our PID. |
| 385 CHECK(SendZygoteChildPing(pid_oracle.get())); | 385 CHECK(SendZygoteChildPing(pid_oracle.get())); |
| 386 | 386 |
| 387 // Now read back our real PID from the zygote. | 387 // Now read back our real PID from the zygote. |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 PickleIterator iter) { | 582 PickleIterator iter) { |
| 583 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != | 583 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != |
| 584 sizeof(sandbox_flags_)) { | 584 sizeof(sandbox_flags_)) { |
| 585 PLOG(ERROR) << "write"; | 585 PLOG(ERROR) << "write"; |
| 586 } | 586 } |
| 587 | 587 |
| 588 return false; | 588 return false; |
| 589 } | 589 } |
| 590 | 590 |
| 591 } // namespace content | 591 } // namespace content |
| OLD | NEW |