summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-09 19:59:25 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-09 19:59:25 +0000
commit3b781fed071f7681c6113dd0042388ceaf7f4d15 (patch)
treec450c72a09a9e8ae442cd0c3b9902df046077537
parent273865aa130f61f321d3eeafc0ea5a2a6dc9adf8 (diff)
downloadchromium_src-3b781fed071f7681c6113dd0042388ceaf7f4d15.zip
chromium_src-3b781fed071f7681c6113dd0042388ceaf7f4d15.tar.gz
chromium_src-3b781fed071f7681c6113dd0042388ceaf7f4d15.tar.bz2
The ChromeFrame crash reporting code should not depend on chrome frame as it is also linked
in by toolbar. This CL gets rid of this dependency and also ensures that full crash dumps are gathered during chrome frame reliability test runs. Review URL: http://codereview.chromium.org/481003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34180 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome_frame/chrome_frame_reporting.cc32
-rw-r--r--chrome_frame/crash_reporting/crash_report.cc31
-rw-r--r--chrome_frame/crash_reporting/crash_report.h7
3 files changed, 45 insertions, 25 deletions
diff --git a/chrome_frame/chrome_frame_reporting.cc b/chrome_frame/chrome_frame_reporting.cc
index 688651e..202d43c 100644
--- a/chrome_frame/chrome_frame_reporting.cc
+++ b/chrome_frame/chrome_frame_reporting.cc
@@ -15,6 +15,7 @@
// Well known SID for the system principal.
const wchar_t kSystemPrincipalSid[] = L"S-1-5-18";
+const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices";
// Returns the custom info structure based on the dll in parameter
google_breakpad::CustomClientInfo* GetCustomInfo(const wchar_t* dll_path) {
@@ -48,19 +49,30 @@ extern "C" IMAGE_DOS_HEADER __ImageBase;
bool InitializeCrashReporting() {
// In headless mode we want crashes to be reported back.
- if (!IsHeadlessMode()) {
- // We want to use the Google Update crash reporting. We need to check if the
- // user allows it first.
- if (!GoogleUpdateSettings::GetCollectStatsConsent())
+ bool always_take_dump = IsHeadlessMode();
+ // We want to use the Google Update crash reporting. We need to check if the
+ // user allows it first.
+ if (!always_take_dump && !GoogleUpdateSettings::GetCollectStatsConsent())
return true;
+
+ // Get the alternate dump directory. We use the temp path.
+ FilePath temp_directory;
+ if (!file_util::GetTempDir(&temp_directory) || temp_directory.empty()) {
+ return false;
}
- // Build the pipe name. It can be either:
- // System-wide install: "NamedPipe\GoogleCrashServices\S-1-5-18"
- // Per-user install: "NamedPipe\GoogleCrashServices\<user SID>"
+
wchar_t dll_path[MAX_PATH * 2] = {0};
GetModuleFileName(reinterpret_cast<HMODULE>(&__ImageBase), dll_path,
arraysize(dll_path));
+ if (always_take_dump) {
+ return InitializeVectoredCrashReportingWithPipeName(true, kChromePipeName,
+ temp_directory.value(), GetCustomInfo(dll_path));
+ }
+
+ // Build the pipe name. It can be either:
+ // System-wide install: "NamedPipe\GoogleCrashServices\S-1-5-18"
+ // Per-user install: "NamedPipe\GoogleCrashServices\<user SID>"
std::wstring user_sid;
if (InstallUtil::IsPerUserInstall(dll_path)) {
if (!win_util::GetUserSidString(&user_sid)) {
@@ -70,12 +82,6 @@ bool InitializeCrashReporting() {
user_sid = kSystemPrincipalSid;
}
- // Get the alternate dump directory. We use the temp path.
- FilePath temp_directory;
- if (!file_util::GetTempDir(&temp_directory) || temp_directory.empty()) {
- return false;
- }
-
return InitializeVectoredCrashReporting(false, user_sid.c_str(),
temp_directory.value(), GetCustomInfo(dll_path));
}
diff --git a/chrome_frame/crash_reporting/crash_report.cc b/chrome_frame/crash_reporting/crash_report.cc
index f858941..43d602d 100644
--- a/chrome_frame/crash_reporting/crash_report.cc
+++ b/chrome_frame/crash_reporting/crash_report.cc
@@ -11,12 +11,10 @@
#include "breakpad/src/client/windows/handler/exception_handler.h"
#include "chrome_frame/crash_reporting/vectored_handler.h"
#include "chrome_frame/crash_reporting/vectored_handler-impl.h"
-#include "chrome_frame/utils.h"
namespace {
// TODO(joshia): factor out common code with chrome used for crash reporting
const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\";
-const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices";
google_breakpad::ExceptionHandler* g_breakpad = NULL;
@@ -61,26 +59,19 @@ class Win32VEHTraits : public VEHTraitsBase {
extern "C" IMAGE_DOS_HEADER __ImageBase;
std::wstring GetCrashServerPipeName(const std::wstring& user_sid) {
- if (IsHeadlessMode())
- return kChromePipeName;
-
std::wstring pipe_name = kGoogleUpdatePipeName;
pipe_name += user_sid;
return pipe_name;
}
-bool InitializeVectoredCrashReporting(
+bool InitializeVectoredCrashReportingWithPipeName(
bool full_dump,
- const wchar_t* user_sid,
+ const wchar_t* pipe_name,
const std::wstring& dump_path,
google_breakpad::CustomClientInfo* client_info) {
- DCHECK(user_sid);
- DCHECK(client_info);
if (g_breakpad)
return true;
- std::wstring pipe_name = GetCrashServerPipeName(user_sid);
-
if (dump_path.empty()) {
return false;
}
@@ -90,7 +81,7 @@ bool InitializeVectoredCrashReporting(
dump_path, NULL, NULL, NULL,
google_breakpad::ExceptionHandler::HANDLER_INVALID_PARAMETER |
google_breakpad::ExceptionHandler::HANDLER_PURECALL, dump_type,
- pipe_name.c_str(), client_info);
+ pipe_name, client_info);
if (g_breakpad) {
// Find current module boundaries.
@@ -105,6 +96,22 @@ bool InitializeVectoredCrashReporting(
return g_breakpad != NULL;
}
+bool InitializeVectoredCrashReporting(
+ bool full_dump,
+ const wchar_t* user_sid,
+ const std::wstring& dump_path,
+ google_breakpad::CustomClientInfo* client_info) {
+ DCHECK(user_sid);
+ DCHECK(client_info);
+
+ std::wstring pipe_name = GetCrashServerPipeName(user_sid);
+
+ return InitializeVectoredCrashReportingWithPipeName(full_dump,
+ pipe_name.c_str(),
+ dump_path,
+ client_info);
+}
+
bool ShutdownVectoredCrashReporting() {
VectoredHandler::Unregister();
delete g_breakpad;
diff --git a/chrome_frame/crash_reporting/crash_report.h b/chrome_frame/crash_reporting/crash_report.h
index 0bcc89b..e98fd05 100644
--- a/chrome_frame/crash_reporting/crash_report.h
+++ b/chrome_frame/crash_reporting/crash_report.h
@@ -16,6 +16,13 @@ bool InitializeVectoredCrashReporting(
const wchar_t* user_sid,
const std::wstring& dump_path,
google_breakpad::CustomClientInfo* client_info);
+
+bool InitializeVectoredCrashReportingWithPipeName(
+ bool full_dump,
+ const wchar_t* pipe_name,
+ const std::wstring& dump_path,
+ google_breakpad::CustomClientInfo* client_info);
+
bool ShutdownVectoredCrashReporting();
#endif // CHROME_FRAME_CRASH_REPORTING_CRASH_REPORT_H_