#include "common/crash_reporter/crash_reporter_win.h"
+#include "base/logging.h"
#include "base/memory/singleton.h"
namespace crash_reporter {
-CrashReporterWin::CrashReporterWin()
- : breakpad_(NULL) {
+CrashReporterWin::CrashReporterWin() {
}
CrashReporterWin::~CrashReporterWin() {
- if (breakpad_ != NULL)
- BreakpadRelease(breakpad_);
}
void CrashReporterWin::InitBreakpad(const std::string& product_name,
const std::string& submit_url,
bool auto_submit,
bool skip_system_crash_handler) {
+ skip_system_crash_handler_ = skip_system_crash_handler;
+
+ wchar_t temp_dir[MAX_PATH] = { 0 };
+ ::GetTempPathW(MAX_PATH, temp_dir);
+
+ breakpad_.reset(new google_breakpad::ExceptionHandler(temp_dir,
+ FilterCallback,
+ MinidumpCallback,
+ this,
+ google_breakpad::ExceptionHandler::HANDLER_ALL));
}
void CrashReporterWin::SetUploadParameters() {
upload_parameters_["platform"] = "win32";
}
+// static
+bool CrashReporterWin::FilterCallback(void* context,
+ EXCEPTION_POINTERS* exinfo,
+ MDRawAssertionInfo* assertion) {
+ return true;
+}
+
+// static
+bool CrashReporterWin::MinidumpCallback(const wchar_t* dump_path,
+ const wchar_t* minidump_id,
+ void* context,
+ EXCEPTION_POINTERS* exinfo,
+ MDRawAssertionInfo* assertion,
+ bool succeeded) {
+ CrashReporterWin* self = static_cast<CrashReporterWin*>(context);
+ if (succeeded && !self->skip_system_crash_handler_)
+ return true;
+ else
+ return false;
+}
+
// static
CrashReporterWin* CrashReporterWin::GetInstance() {
return Singleton<CrashReporterWin>::get();
#define ATOM_COMMON_CRASH_REPORTER_CRASH_REPORTER_WIN_H_
#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
#include "common/crash_reporter/crash_reporter.h"
+#include "vendor/breakpad/src/client/windows/handler/exception_handler.h"
template <typename T> struct DefaultSingletonTraits;
CrashReporterWin();
virtual ~CrashReporterWin();
+ static bool FilterCallback(void* context,
+ EXCEPTION_POINTERS* exinfo,
+ MDRawAssertionInfo* assertion);
+
+ static bool MinidumpCallback(const wchar_t* dump_path,
+ const wchar_t* minidump_id,
+ void* context,
+ EXCEPTION_POINTERS* exinfo,
+ MDRawAssertionInfo* assertion,
+ bool succeeded);
+
+ bool skip_system_crash_handler_;
+ scoped_ptr<google_breakpad::ExceptionHandler> breakpad_;
+
DISALLOW_COPY_AND_ASSIGN(CrashReporterWin);
};