Index: chrome/app/chrome_dll_main.cc |
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc |
index b6ba22f0751afb60c7a898165fbfac63c5b69a31..3b5dda939077a56c8ee16f617d22e8d4140ef7af 100644 |
--- a/chrome/app/chrome_dll_main.cc |
+++ b/chrome/app/chrome_dll_main.cc |
@@ -34,6 +34,9 @@ |
#include "base/at_exit.h" |
#include "base/command_line.h" |
#include "base/debug_util.h" |
+#if defined(OS_POSIX) |
+#include "base/global_descriptors_posix.h" |
+#endif |
#include "base/icu_util.h" |
#include "base/message_loop.h" |
#include "base/path_service.h" |
@@ -45,9 +48,6 @@ |
#if defined(OS_WIN) |
#include "base/win_util.h" |
#endif |
-#if defined(OS_LINUX) |
-#include "base/zygote_manager.h" |
-#endif |
#if defined(OS_MACOSX) |
#include "chrome/app/breakpad_mac.h" |
#elif defined(OS_LINUX) |
@@ -57,6 +57,7 @@ |
#include "chrome/browser/renderer_host/render_process_host.h" |
#include "chrome/common/chrome_constants.h" |
#include "chrome/common/chrome_counters.h" |
+#include "chrome/common/chrome_descriptors.h" |
#include "chrome/common/chrome_paths.h" |
#include "chrome/common/chrome_switches.h" |
#include "chrome/common/logging_chrome.h" |
@@ -75,6 +76,7 @@ extern int RendererMain(const MainFunctionParams&); |
extern int PluginMain(const MainFunctionParams&); |
extern int WorkerMain(const MainFunctionParams&); |
extern int UtilityMain(const MainFunctionParams&); |
+extern int ZygoteMain(const MainFunctionParams&); |
#if defined(OS_WIN) |
// TODO(erikkay): isn't this already defined somewhere? |
@@ -292,21 +294,17 @@ int ChromeMain(int argc, const char** argv) { |
// its main event loop to get rid of the cruft. |
base::ScopedNSAutoreleasePool autorelease_pool; |
+#if defined(OS_POSIX) |
+ base::GlobalDescriptors* g_fds = Singleton<base::GlobalDescriptors>::get(); |
+ g_fds->Set(kPrimaryIPCChannel, kPrimaryIPCChannel + 3); |
+#if defined(OS_LINUX) |
+ g_fds->Set(kCrashDumpSignal, kCrashDumpSignal + 3); |
+#endif |
+#endif |
+ |
// Initialize the command line. |
#if defined(OS_WIN) |
CommandLine::Init(0, NULL); |
-#elif defined(OS_LINUX) |
- base::ZygoteManager* zm = base::ZygoteManager::Get(); |
- std::vector<std::string>* zargv = NULL; |
- if (zm) |
- zargv = zm->Start(); |
- if (zargv) { |
- // Forked child. |
- CommandLine::Init(*zargv); |
- } else { |
- // Original process. |
- CommandLine::Init(argc, argv); |
- } |
#else |
CommandLine::Init(argc, argv); |
#endif |
@@ -339,11 +337,13 @@ int ChromeMain(int argc, const char** argv) { |
CHECK(sigaction(SIGPIPE, &action, 0) == 0); |
#endif // OS_POSIX |
} else { |
+#if defined(OS_WIN) |
std::wstring channel_name = |
parsed_command_line.GetSwitchValue(switches::kProcessChannelID); |
browser_pid = StringToInt(WideToASCII(channel_name)); |
DCHECK(browser_pid != 0); |
+#endif |
#if defined(OS_POSIX) |
// When you hit Ctrl-C in a terminal running the browser |
@@ -489,6 +489,13 @@ int ChromeMain(int argc, const char** argv) { |
#else |
NOTIMPLEMENTED(); |
#endif |
+ } else if (process_type == switches::kZygoteProcess) { |
+#if defined(OS_LINUX) |
+ if (ZygoteMain(main_params)) |
+ RendererMain(main_params); |
+#else |
+ NOTIMPLEMENTED(); |
+#endif |
} else if (process_type.empty()) { |
#if defined(OS_LINUX) |
// Glib type system initialization. Needed at least for gconf, |