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

Unified Diff: base/process_util_linux.cc

Issue 115773: Prototype implementation of zygotes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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') | base/reserved_file_descriptors.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_linux.cc
===================================================================
--- base/process_util_linux.cc (revision 17632)
+++ base/process_util_linux.cc (working copy)
@@ -17,6 +17,7 @@
#include "base/logging.h"
#include "base/string_tokenizer.h"
#include "base/string_util.h"
+#include "base/zygote_manager.h"
namespace {
@@ -41,6 +42,22 @@
namespace base {
+bool ForkApp(const std::vector<std::string>& argv,
+ const file_handle_mapping_vector& fds_to_remap,
+ ProcessHandle* process_handle) {
+ ZygoteManager* zm = ZygoteManager::Get();
+ if (!zm)
+ return LaunchApp(argv, fds_to_remap, false, process_handle);
+
+ pid_t pid = zm->LongFork(argv, fds_to_remap);
+ if (pid < 0)
+ return false;
+
+ if (process_handle)
+ *process_handle = pid;
+ return true;
+}
+
bool LaunchApp(const std::vector<std::string>& argv,
const file_handle_mapping_vector& fds_to_remap,
bool wait, ProcessHandle* process_handle) {
@@ -65,6 +82,8 @@
argv_cstr[i] = const_cast<char*>(argv[i].c_str());
argv_cstr[argv.size()] = NULL;
execvp(argv_cstr[0], argv_cstr.get());
+ LOG(ERROR) << "LaunchApp: exec failed!, argv_cstr[0] " << argv_cstr[0]
+ << ", errno " << errno;
exit(127);
} else {
if (wait)
« no previous file with comments | « base/process_util.h ('k') | base/reserved_file_descriptors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698