summaryrefslogtreecommitdiffstats
path: root/chrome_frame/crash_server_init.cc
diff options
context:
space:
mode:
authorrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-03 19:57:42 +0000
committerrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-03 19:57:42 +0000
commite4fe427bde7602c8b38996889a0eface92e1a770 (patch)
tree11a741f8da1ba12fff192fd3be9c182de5523150 /chrome_frame/crash_server_init.cc
parente2abdeb2f6ad46c39153ccfbf233f552f0f9691a (diff)
downloadchromium_src-e4fe427bde7602c8b38996889a0eface92e1a770.zip
chromium_src-e4fe427bde7602c8b38996889a0eface92e1a770.tar.gz
chromium_src-e4fe427bde7602c8b38996889a0eface92e1a770.tar.bz2
Add crash reporting to the long running Chrome Frame helper process.
BUG=53127 TEST=chrome_frame_helper.exe connects to the crash process. Review URL: http://codereview.chromium.org/3287008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58530 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/crash_server_init.cc')
-rw-r--r--chrome_frame/crash_server_init.cc59
1 files changed, 59 insertions, 0 deletions
diff --git a/chrome_frame/crash_server_init.cc b/chrome_frame/crash_server_init.cc
new file mode 100644
index 0000000..0f52215
--- /dev/null
+++ b/chrome_frame/crash_server_init.cc
@@ -0,0 +1,59 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome_frame/crash_server_init.h"
+
+#include "version.h" // NOLINT
+
+const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices";
+const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\";
+const wchar_t kSystemPrincipalSid[] = L"S-1-5-18";
+
+const wchar_t kFullMemoryCrashReport[] = L"full-memory-crash-report";
+
+const MINIDUMP_TYPE kLargerDumpType = static_cast<MINIDUMP_TYPE>(
+ MiniDumpWithProcessThreadData | // Get PEB and TEB.
+ MiniDumpWithUnloadedModules | // Get unloaded modules when available.
+ MiniDumpWithIndirectlyReferencedMemory); // Get memory referenced by stack.
+
+google_breakpad::CustomClientInfo* GetCustomInfo() {
+ static google_breakpad::CustomInfoEntry ver_entry(
+ L"ver", TEXT(CHROME_VERSION_STRING));
+ static google_breakpad::CustomInfoEntry prod_entry(L"prod", L"ChromeFrame");
+ static google_breakpad::CustomInfoEntry plat_entry(L"plat", L"Win32");
+ static google_breakpad::CustomInfoEntry type_entry(L"ptype", L"chrome_frame");
+ static google_breakpad::CustomInfoEntry entries[] = {
+ ver_entry, prod_entry, plat_entry, type_entry };
+ static google_breakpad::CustomClientInfo custom_info = {
+ entries, ARRAYSIZE(entries) };
+ return &custom_info;
+}
+
+google_breakpad::ExceptionHandler* InitializeCrashReporting(
+ const wchar_t* cmd_line) {
+ if (cmd_line == NULL) {
+ return NULL;
+ }
+
+ wchar_t temp_path[MAX_PATH + 1] = {0};
+ DWORD path_len = ::GetTempPath(MAX_PATH, temp_path);
+
+ std::wstring pipe_name;
+ if (wcsstr(cmd_line, kFullMemoryCrashReport) != NULL) {
+ pipe_name = kChromePipeName;
+ } else {
+ // TODO(robertshield): Figure out if we're a per-user install and connect
+ // to the per-user named pipe instead.
+ pipe_name = kGoogleUpdatePipeName;
+ pipe_name += kSystemPrincipalSid;
+ }
+
+ google_breakpad::ExceptionHandler* breakpad =
+ new google_breakpad::ExceptionHandler(
+ temp_path, NULL, NULL, NULL,
+ google_breakpad::ExceptionHandler::HANDLER_ALL, kLargerDumpType,
+ pipe_name.c_str(), GetCustomInfo());
+
+ return breakpad;
+}