diff options
author | initial.commit@chromium.org <initial.commit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-02 02:14:31 +0000 |
---|---|---|
committer | initial.commit@chromium.org <initial.commit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-02 02:14:31 +0000 |
commit | 5a7bdf208c28c210b39cff63d1cf91302b02821b (patch) | |
tree | 5ff484561562f78b29d2670168a9e3b40b48dcab /ceee/ie/common/crash_reporter.cc | |
parent | 26a54a5e0f4603c8fda2fe51789d331125993c9a (diff) | |
download | chromium_src-5a7bdf208c28c210b39cff63d1cf91302b02821b.zip chromium_src-5a7bdf208c28c210b39cff63d1cf91302b02821b.tar.gz chromium_src-5a7bdf208c28c210b39cff63d1cf91302b02821b.tar.bz2 |
Checking in the initial version of CEEE (Chrome Extensions Execution
Environment), an optional feature of Chrome Frame that acts as an
adapter layer for a subset of the Chrome Extension APIs. This enables
extensions that stick to the supported subset of APIs to work in the
context of Chrome Frame with minimal or sometimes no changes.
See http://www.chromium.org/developers/design-documents/ceee for an
overview of the design of CEEE.
TEST=unit tests (run ceee/smoke_tests.bat as an administrator on Windows)
BUG=none
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64712 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ceee/ie/common/crash_reporter.cc')
-rw-r--r-- | ceee/ie/common/crash_reporter.cc | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/ceee/ie/common/crash_reporter.cc b/ceee/ie/common/crash_reporter.cc new file mode 100644 index 0000000..4ed9b5c --- /dev/null +++ b/ceee/ie/common/crash_reporter.cc @@ -0,0 +1,75 @@ +// 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. +// +// Definition of IE crash reporter. + +#include "ceee/ie/common/crash_reporter.h" + +#include "base/logging.h" +#include "ceee/ie/common/ceee_module_util.h" + +const wchar_t kGoogleUpdatePipeName[] = + L"\\\\.\\pipe\\GoogleCrashServices\\S-1-5-18"; + +CrashReporter::CrashReporter(const wchar_t* component_name) + : exception_handler_(NULL) { + // Initialize the custom data that will be used to identify the client + // when reporting a crash. + // TODO(jeffbailey@google.com): Inherit Chrome's version number. + // (bb3143594). + google_breakpad::CustomInfoEntry ver_entry(L"ver", L"Ver.Goes.Here"); + google_breakpad::CustomInfoEntry prod_entry(L"prod", L"CEEE_IE"); + google_breakpad::CustomInfoEntry plat_entry(L"plat", L"Win32"); + google_breakpad::CustomInfoEntry type_entry(L"ptype", component_name); + google_breakpad::CustomInfoEntry entries[] = { + ver_entry, prod_entry, plat_entry, type_entry }; + + const int num_entries = arraysize(entries); + client_info_entries_.reset( + new google_breakpad::CustomInfoEntry[num_entries]); + + for (int i = 0; i < num_entries; ++i) { + client_info_entries_[i] = entries[i]; + } + + client_info_.entries = client_info_entries_.get(); + client_info_.count = num_entries; +} + +CrashReporter::~CrashReporter() { + DCHECK(exception_handler_ == NULL); +} + +void CrashReporter::InitializeCrashReporting(bool full_dump) { + DCHECK(exception_handler_ == NULL); + + if (!ceee_module_util::GetCollectStatsConsent()) + return; + + wchar_t temp_path[MAX_PATH]; + DWORD len = ::GetTempPath(arraysize(temp_path), temp_path); + if (len == 0) { + LOG(ERROR) << "Failed to instantiate Breakpad exception handler. " << + "Could not get a temp path."; + return; + } + + // Install an exception handler instance here, which should be the lowest + // level in the process. We give it the appropriate pipe name so it can + // talk to the reporting service (e.g. Omaha) to do dump generation and + // send information back to the server. + MINIDUMP_TYPE dump_type = full_dump ? MiniDumpWithFullMemory : MiniDumpNormal; + exception_handler_ = new google_breakpad::ExceptionHandler( + temp_path, NULL, NULL, NULL, + google_breakpad::ExceptionHandler::HANDLER_ALL, dump_type, + kGoogleUpdatePipeName, &client_info_); + + LOG_IF(ERROR, exception_handler_ == NULL) << + "Failed to instantiate Breakpad exception handler."; +} + +void CrashReporter::ShutdownCrashReporting() { + delete exception_handler_; + exception_handler_ = NULL; +} |