| 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 <dirent.h> | 5 #include <dirent.h> |
| 6 #include <errno.h> | 6 #include <errno.h> |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <signal.h> | 8 #include <signal.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 // itself. | 542 // itself. |
| 543 ++fd_shuffle_size; | 543 ++fd_shuffle_size; |
| 544 } | 544 } |
| 545 #endif // defined(OS_MACOSX) | 545 #endif // defined(OS_MACOSX) |
| 546 | 546 |
| 547 InjectiveMultimap fd_shuffle1; | 547 InjectiveMultimap fd_shuffle1; |
| 548 InjectiveMultimap fd_shuffle2; | 548 InjectiveMultimap fd_shuffle2; |
| 549 fd_shuffle1.reserve(fd_shuffle_size); | 549 fd_shuffle1.reserve(fd_shuffle_size); |
| 550 fd_shuffle2.reserve(fd_shuffle_size); | 550 fd_shuffle2.reserve(fd_shuffle_size); |
| 551 | 551 |
| 552 scoped_array<char*> argv_cstr(new char*[argv.size() + 1]); | 552 scoped_ptr<char*[]> argv_cstr(new char*[argv.size() + 1]); |
| 553 scoped_array<char*> new_environ; | 553 scoped_ptr<char*[]> new_environ; |
| 554 if (options.environ) | 554 if (options.environ) |
| 555 new_environ.reset(AlterEnvironment(*options.environ, GetEnvironment())); | 555 new_environ.reset(AlterEnvironment(*options.environ, GetEnvironment())); |
| 556 | 556 |
| 557 #if defined(OS_MACOSX) | 557 #if defined(OS_MACOSX) |
| 558 int synchronization_pipe_fds[2]; | 558 int synchronization_pipe_fds[2]; |
| 559 file_util::ScopedFD synchronization_read_fd; | 559 file_util::ScopedFD synchronization_read_fd; |
| 560 file_util::ScopedFD synchronization_write_fd; | 560 file_util::ScopedFD synchronization_write_fd; |
| 561 | 561 |
| 562 if (options.synchronize) { | 562 if (options.synchronize) { |
| 563 // wait means "don't return from LaunchProcess until the child exits", and | 563 // wait means "don't return from LaunchProcess until the child exits", and |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 int* exit_code) { | 1005 int* exit_code) { |
| 1006 // Doing a blocking wait for another command to finish counts as IO. | 1006 // Doing a blocking wait for another command to finish counts as IO. |
| 1007 base::ThreadRestrictions::AssertIOAllowed(); | 1007 base::ThreadRestrictions::AssertIOAllowed(); |
| 1008 // exit_code must be supplied so calling function can determine success. | 1008 // exit_code must be supplied so calling function can determine success. |
| 1009 DCHECK(exit_code); | 1009 DCHECK(exit_code); |
| 1010 *exit_code = EXIT_FAILURE; | 1010 *exit_code = EXIT_FAILURE; |
| 1011 | 1011 |
| 1012 int pipe_fd[2]; | 1012 int pipe_fd[2]; |
| 1013 pid_t pid; | 1013 pid_t pid; |
| 1014 InjectiveMultimap fd_shuffle1, fd_shuffle2; | 1014 InjectiveMultimap fd_shuffle1, fd_shuffle2; |
| 1015 scoped_array<char*> argv_cstr(new char*[argv.size() + 1]); | 1015 scoped_ptr<char*[]> argv_cstr(new char*[argv.size() + 1]); |
| 1016 | 1016 |
| 1017 fd_shuffle1.reserve(3); | 1017 fd_shuffle1.reserve(3); |
| 1018 fd_shuffle2.reserve(3); | 1018 fd_shuffle2.reserve(3); |
| 1019 | 1019 |
| 1020 // Either |do_search_path| should be false or |envp| should be null, but not | 1020 // Either |do_search_path| should be false or |envp| should be null, but not |
| 1021 // both. | 1021 // both. |
| 1022 DCHECK(!do_search_path ^ !envp); | 1022 DCHECK(!do_search_path ^ !envp); |
| 1023 | 1023 |
| 1024 if (pipe(pipe_fd) < 0) | 1024 if (pipe(pipe_fd) < 0) |
| 1025 return EXECUTE_FAILURE; | 1025 return EXECUTE_FAILURE; |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1271 if (IsChildDead(process)) | 1271 if (IsChildDead(process)) |
| 1272 return; | 1272 return; |
| 1273 | 1273 |
| 1274 BackgroundReaper* reaper = new BackgroundReaper(process, 0); | 1274 BackgroundReaper* reaper = new BackgroundReaper(process, 0); |
| 1275 PlatformThread::CreateNonJoinable(0, reaper); | 1275 PlatformThread::CreateNonJoinable(0, reaper); |
| 1276 } | 1276 } |
| 1277 | 1277 |
| 1278 #endif // !defined(OS_MACOSX) | 1278 #endif // !defined(OS_MACOSX) |
| 1279 | 1279 |
| 1280 } // namespace base | 1280 } // namespace base |
| OLD | NEW |