summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-15 02:04:21 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-15 02:04:21 +0000
commit0abe2cbeb51078bf2f14496fac9a1d7a2e21a919 (patch)
tree17cbd45a663de156b1d1f15f9c3d855a9d2782d5 /chrome/common
parentd0620522264c47074c3602fa8dfb7ad5fbf64e64 (diff)
downloadchromium_src-0abe2cbeb51078bf2f14496fac9a1d7a2e21a919.zip
chromium_src-0abe2cbeb51078bf2f14496fac9a1d7a2e21a919.tar.gz
chromium_src-0abe2cbeb51078bf2f14496fac9a1d7a2e21a919.tar.bz2
Change breakpads on the helper processes to keep our rimZ clean.
Initialize crash reporting in helper processes such as the renderer process. Renderer crash reporting stopped working in r23006 when multiple .app bundles were introduced, because the stats collection and crash reporting preference is presently accessed via NSUserDefaults, keyed on the bundle ID. The main browser process and helper processes have distinct bundle IDs. In the new scheme, only the main browser process consults this preference, and passes it to helper processes in their command lines. BUG=19204 TEST=When reporting is enabled, Breakpad should pick up browser and renderer process crashes; When reporting is enabled, renderer should not log messages like [mmdd/hhmmss:WARNING:/path/to/breakpad_mac.mm(47)] Breakpad disabled; When reporting is disabled, browser and renderer should both log these messages. Review URL: http://codereview.chromium.org/165546 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23509 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/DEPS1
-rw-r--r--chrome/common/child_process_host.cc31
-rw-r--r--chrome/common/child_process_host.h8
-rw-r--r--chrome/common/chrome_switches.cc11
-rw-r--r--chrome/common/chrome_switches.h5
5 files changed, 50 insertions, 6 deletions
diff --git a/chrome/common/DEPS b/chrome/common/DEPS
index ed2c80a..50f16bfb 100644
--- a/chrome/common/DEPS
+++ b/chrome/common/DEPS
@@ -17,4 +17,5 @@ include_rules = [
# FIXME - refactor code and remove these dependencies
"+chrome/app",
"+chrome/browser",
+ "+chrome/installer",
]
diff --git a/chrome/common/child_process_host.cc b/chrome/common/child_process_host.cc
index ca0f972..1fa91f9 100644
--- a/chrome/common/child_process_host.cc
+++ b/chrome/common/child_process_host.cc
@@ -12,6 +12,7 @@
#include "base/path_service.h"
#include "base/process_util.h"
#include "base/singleton.h"
+#include "base/string_util.h"
#include "base/waitable_event.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/common/chrome_switches.h"
@@ -20,10 +21,23 @@
#include "chrome/common/plugin_messages.h"
#include "chrome/common/process_watcher.h"
#include "chrome/common/result_codes.h"
+#include "chrome/installer/util/google_update_settings.h"
#include "ipc/ipc_logging.h"
+#if defined(OS_LINUX)
+#include "base/linux_util.h"
+
+// This is defined in chrome/browser/google_update_settings_linux.cc. It's the
+// static string containing the user's unique GUID. We send this in the crash
+// report.
+namespace google_update {
+extern std::string linux_guid;
+} // namespace google_update
+#endif // OS_LINUX
+
namespace {
+
typedef std::list<ChildProcessHost*> ChildProcessList;
// The NotificationTask is used to notify about plugin process connection/
@@ -49,7 +63,6 @@ class ChildNotificationTask : public Task {
} // namespace
-
ChildProcessHost::ChildProcessHost(
ProcessType type, ResourceDispatcherHost* resource_dispatcher_host)
: Receiver(type),
@@ -130,6 +143,22 @@ std::wstring ChildProcessHost::GetChildPath() {
#endif // OS_MACOSX
}
+// static
+void ChildProcessHost::SetCrashReporterCommandLine(CommandLine* command_line) {
+#if defined(OS_POSIX)
+ if (GoogleUpdateSettings::GetCollectStatsConsent()) {
+#if defined(OS_LINUX)
+ command_line->AppendSwitchWithValue(switches::kEnableCrashReporter,
+ ASCIIToWide(google_update::linux_guid +
+ "," +
+ base::GetLinuxDistro()));
+#else // !OS_LINUX
+ command_line->AppendSwitch(switches::kEnableCrashReporter);
+#endif // !OS_LINUX
+ }
+#endif // OS_POSIX
+}
+
bool ChildProcessHost::CreateChannel() {
channel_id_ = GenerateRandomChannelID(this);
channel_.reset(new IPC::Channel(
diff --git a/chrome/common/child_process_host.h b/chrome/common/child_process_host.h
index 95b97b6..cb833dc 100644
--- a/chrome/common/child_process_host.h
+++ b/chrome/common/child_process_host.h
@@ -13,6 +13,7 @@
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "ipc/ipc_channel.h"
+class CommandLine;
class NotificationType;
// Plugins/workers and other child processes that live on the IO thread should
@@ -29,6 +30,13 @@ class ChildProcessHost : public ResourceDispatcherHost::Receiver,
// returns an empty wstring.
static std::wstring GetChildPath();
+ // Prepares command_line for crash reporting as appropriate. On Linux and
+ // Mac, a command-line flag to enable crash reporting in the child process
+ // will be appended if needed, because the child process may not have access
+ // to the data that determines the status of crash reporting in the
+ // currently-executing process. This function is a no-op on Windows.
+ static void SetCrashReporterCommandLine(CommandLine* command_line);
+
// ResourceDispatcherHost::Receiver implementation:
virtual bool Send(IPC::Message* msg);
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 6c8d381..4204e27 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -529,10 +529,13 @@ const wchar_t kEnableMonitorProfile[] = L"enable-monitor-profile";
// still experimental.
const wchar_t kEnableXSSAuditor[] = L"enable-xss-auditor";
-// A flag, generated internally by Chrome for renderer command lines (Linux
-// only). It tells the renderer to enable crash dumping since it cannot access
-// the user's home directory to find out for itself.
-const wchar_t kRendererCrashDump[] = L"renderer-crash-dumping";
+#if defined(OS_POSIX)
+// A flag, generated internally by Chrome for renderer and other helper process
+// command lines on Linux and Mac. It tells the helper process to enable crash
+// dumping and reporting, because helpers cannot access the profile or other
+// files needed to make this decision.
+const wchar_t kEnableCrashReporter[] = L"enable-crash-reporter";
+#endif
// Enables the new Tabstrip on Windows.
const wchar_t kEnableTabtastic2[] = L"enable-tabtastic2";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 976d88a..e3ff1a9 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -7,6 +7,7 @@
#ifndef CHROME_COMMON_CHROME_SWITCHES_H_
#define CHROME_COMMON_CHROME_SWITCHES_H_
+#include "build/build_config.h"
#include "base/base_switches.h"
namespace switches {
@@ -200,7 +201,9 @@ extern const wchar_t kEnableMonitorProfile[];
extern const wchar_t kEnableXSSAuditor[];
-extern const wchar_t kRendererCrashDump[];
+#if defined(OS_POSIX)
+extern const wchar_t kEnableCrashReporter[];
+#endif
extern const wchar_t kEnableTabtastic2[];