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

Unified Diff: base/process_util_posix.cc

Issue 13845008: [Mac] Remove base::LaunchSynchronize and rewrite content::MachBroker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix link_settings Created 7 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/process_util.h ('k') | content/app/content_main_runner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_posix.cc
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc
index 52e964bca1c48cd27bbb70ce098c92be95449b99..98ec183b8d67eabe43167406e0dcb9270a0091a6 100644
--- a/base/process_util_posix.cc
+++ b/base/process_util_posix.cc
@@ -604,15 +604,6 @@ bool LaunchProcess(const std::vector<std::string>& argv,
fd_shuffle_size = options.fds_to_remap->size();
}
-#if defined(OS_MACOSX)
- if (options.synchronize) {
- // When synchronizing, the "read" end of the synchronization pipe needs
- // to make it to the child process. This is handled by mapping it back to
- // itself.
- ++fd_shuffle_size;
- }
-#endif // defined(OS_MACOSX)
-
InjectiveMultimap fd_shuffle1;
InjectiveMultimap fd_shuffle2;
fd_shuffle1.reserve(fd_shuffle_size);
@@ -623,34 +614,6 @@ bool LaunchProcess(const std::vector<std::string>& argv,
if (options.environ)
new_environ.reset(AlterEnvironment(*options.environ, GetEnvironment()));
-#if defined(OS_MACOSX)
- int synchronization_pipe_fds[2];
- file_util::ScopedFD synchronization_read_fd;
- file_util::ScopedFD synchronization_write_fd;
-
- if (options.synchronize) {
- // wait means "don't return from LaunchProcess until the child exits", and
- // synchronize means "return from LaunchProcess but don't let the child
- // run until LaunchSynchronize is called". These two options are highly
- // incompatible.
- DCHECK(!options.wait);
-
- // Create the pipe used for synchronization.
- if (HANDLE_EINTR(pipe(synchronization_pipe_fds)) != 0) {
- DPLOG(ERROR) << "pipe";
- return false;
- }
-
- // The parent process will only use synchronization_write_fd as the write
- // side of the pipe. It can close the read side as soon as the child
- // process has forked off. The child process will only use
- // synchronization_read_fd as the read side of the pipe. In that process,
- // the write side can be closed as soon as it has forked.
- synchronization_read_fd.reset(&synchronization_pipe_fds[0]);
- synchronization_write_fd.reset(&synchronization_pipe_fds[1]);
- }
-#endif // OS_MACOSX
-
pid_t pid;
#if defined(OS_LINUX)
if (options.clone_flags) {
@@ -743,13 +706,6 @@ bool LaunchProcess(const std::vector<std::string>& argv,
RAW_LOG(INFO, "Right after signal/exception handler restoration.");
}
-#if defined(OS_MACOSX)
- if (options.synchronize) {
- // The "write" side of the synchronization pipe belongs to the parent.
- synchronization_write_fd.reset(); // closes synchronization_pipe_fds[1]
- }
-#endif // defined(OS_MACOSX)
-
#if 0
// When debugging it can be helpful to check that we really aren't making
// any hidden calls to malloc.
@@ -789,16 +745,6 @@ bool LaunchProcess(const std::vector<std::string>& argv,
RAW_LOG(INFO, "Right after fd_shuffle push_backs.");
}
-#if defined(OS_MACOSX)
- if (options.synchronize) {
- // Remap the read side of the synchronization pipe back onto itself,
- // ensuring that it won't be closed by CloseSuperfluousFds.
- int keep_fd = *synchronization_read_fd.get();
- fd_shuffle1.push_back(InjectionArc(keep_fd, keep_fd, false));
- fd_shuffle2.push_back(InjectionArc(keep_fd, keep_fd, false));
- }
-#endif // defined(OS_MACOSX)
-
if (options.environ)
SetEnvironment(new_environ.get());
@@ -816,24 +762,6 @@ bool LaunchProcess(const std::vector<std::string>& argv,
RAW_LOG(INFO, "Right after CloseSuperfluousFds");
}
-#if defined(OS_MACOSX)
- if (options.synchronize) {
- // Do a blocking read to wait until the parent says it's OK to proceed.
- // The byte that's read here is written by LaunchSynchronize.
- char read_char;
- int read_result =
- HANDLE_EINTR(read(*synchronization_read_fd.get(), &read_char, 1));
- if (read_result != 1) {
- RAW_LOG(ERROR, "LaunchProcess: synchronization read: error");
- _exit(127);
- }
-
- // The pipe is no longer useful. Don't let it live on in the new process
- // after exec.
- synchronization_read_fd.reset(); // closes synchronization_pipe_fds[0]
- }
-#endif // defined(OS_MACOSX)
-
if (options.debug) {
RAW_LOG(INFO, "Right before execvp");
}
@@ -858,14 +786,6 @@ bool LaunchProcess(const std::vector<std::string>& argv,
if (process_handle)
*process_handle = pid;
-
-#if defined(OS_MACOSX)
- if (options.synchronize) {
- // The "read" side of the synchronization pipe belongs to the child.
- synchronization_read_fd.reset(); // closes synchronization_pipe_fds[0]
- *options.synchronize = new int(*synchronization_write_fd.release());
- }
-#endif // defined(OS_MACOSX)
}
return true;
@@ -878,19 +798,6 @@ bool LaunchProcess(const CommandLine& cmdline,
return LaunchProcess(cmdline.argv(), options, process_handle);
}
-#if defined(OS_MACOSX)
-void LaunchSynchronize(LaunchSynchronizationHandle handle) {
- int synchronization_fd = *handle;
- file_util::ScopedFD synchronization_fd_closer(&synchronization_fd);
- delete handle;
-
- // Write a '\0' character to the pipe.
- if (HANDLE_EINTR(write(synchronization_fd, "", 1)) != 1) {
- DPLOG(ERROR) << "write";
- }
-}
-#endif // defined(OS_MACOSX)
-
ProcessMetrics::~ProcessMetrics() { }
void RaiseProcessToHighPriority() {
« no previous file with comments | « base/process_util.h ('k') | content/app/content_main_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698