summaryrefslogtreecommitdiffstats
path: root/chrome/app
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/app')
-rw-r--r--chrome/app/breakpad_linux.cc8
-rw-r--r--chrome/app/chrome_dll_main.cc39
-rw-r--r--chrome/app/chrome_main_uitest.cc5
3 files changed, 20 insertions, 32 deletions
diff --git a/chrome/app/breakpad_linux.cc b/chrome/app/breakpad_linux.cc
index ef3dfa2..0ee0bed 100644
--- a/chrome/app/breakpad_linux.cc
+++ b/chrome/app/breakpad_linux.cc
@@ -14,13 +14,13 @@
#include "base/file_version_info_linux.h"
#include "base/path_service.h"
#include "base/rand_util.h"
+#include "base/reserved_file_descriptors.h"
#include "breakpad/linux/directory_reader.h"
#include "breakpad/linux/exception_handler.h"
#include "breakpad/linux/linux_libc_support.h"
#include "breakpad/linux/linux_syscall_support.h"
#include "breakpad/linux/memory.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/chrome_descriptors.h"
#include "chrome/installer/util/google_update_settings.h"
static const char kUploadURL[] =
@@ -501,11 +501,13 @@ RendererCrashHandler(const void* crash_context, size_t crash_context_size,
}
void EnableRendererCrashDumping() {
- const int fd = Singleton<base::GlobalDescriptors>()->Get(kCrashDumpSignal);
+ // When the browser forks off our process, it installs the crash signal file
+ // descriptor in slot kMagicCrashSignalFd.
+
// We deliberately leak this object.
google_breakpad::ExceptionHandler* handler =
new google_breakpad::ExceptionHandler("" /* unused */, NULL, NULL,
- (void*) fd, true);
+ (void*) kMagicCrashSignalFd, true);
handler->set_crash_handler(RendererCrashHandler);
}
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc
index 33e774c..b6ba22f 100644
--- a/chrome/app/chrome_dll_main.cc
+++ b/chrome/app/chrome_dll_main.cc
@@ -34,9 +34,6 @@
#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"
@@ -48,6 +45,9 @@
#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,7 +57,6 @@
#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"
@@ -76,7 +75,6 @@ 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?
@@ -294,19 +292,21 @@ 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 + base::GlobalDescriptors::kBaseDescriptor);
-#if defined(OS_LINUX)
- g_fds->Set(kCrashDumpSignal,
- kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor);
-#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,13 +339,11 @@ 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
@@ -491,13 +489,6 @@ 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,
diff --git a/chrome/app/chrome_main_uitest.cc b/chrome/app/chrome_main_uitest.cc
index f229751..5ce05c2 100644
--- a/chrome/app/chrome_main_uitest.cc
+++ b/chrome/app/chrome_main_uitest.cc
@@ -18,14 +18,9 @@ TEST_F(ChromeMainTest, AppLaunch) {
if (UITest::in_process_renderer()) {
EXPECT_EQ(1, UITest::GetBrowserProcessCount());
} else {
-#if defined(OS_LINUX)
- // On Linux we'll have three processes: browser, renderer and zygote.
- EXPECT_EQ(3, UITest::GetBrowserProcessCount());
-#else
// We should have two instances of the browser process alive -
// one is the Browser and the other is the Renderer.
EXPECT_EQ(2, UITest::GetBrowserProcessCount());
-#endif
}
}