win: Only install breakpad hook when crash-reporter is used
This commit is contained in:
parent
d90b598125
commit
f5c25d6277
3 changed files with 14 additions and 16 deletions
|
@ -19,10 +19,6 @@
|
||||||
#include "content/public/common/content_switches.h"
|
#include "content/public/common/content_switches.h"
|
||||||
#include "ui/base/resource/resource_bundle.h"
|
#include "ui/base/resource/resource_bundle.h"
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
#include "atom/common/crash_reporter/crash_reporter_win.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -73,10 +69,6 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
|
||||||
// Logging with pid and timestamp.
|
// Logging with pid and timestamp.
|
||||||
logging::SetLogItems(true, false, true, false);
|
logging::SetLogItems(true, false, true, false);
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
crash_reporter::SetupV8CodeRangeHook();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(DEBUG) && defined(OS_LINUX)
|
#if defined(DEBUG) && defined(OS_LINUX)
|
||||||
// Enable convient stack printing.
|
// Enable convient stack printing.
|
||||||
base::debug::EnableInProcessStackDumping();
|
base::debug::EnableInProcessStackDumping();
|
||||||
|
|
|
@ -133,11 +133,6 @@ void UnregisterNonABICompliantCodeRange(void* start) {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void SetupV8CodeRangeHook() {
|
|
||||||
gin::Debug::SetCodeRangeCreatedCallback(RegisterNonABICompliantCodeRange);
|
|
||||||
gin::Debug::SetCodeRangeDeletedCallback(UnregisterNonABICompliantCodeRange);
|
|
||||||
}
|
|
||||||
|
|
||||||
CrashReporterWin::CrashReporterWin() {
|
CrashReporterWin::CrashReporterWin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,6 +182,20 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
|
||||||
|
|
||||||
if (!breakpad_->IsOutOfProcess())
|
if (!breakpad_->IsOutOfProcess())
|
||||||
LOG(ERROR) << "Cannot initialize out-of-process crash handler";
|
LOG(ERROR) << "Cannot initialize out-of-process crash handler";
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
// Hook up V8 to breakpad.
|
||||||
|
{
|
||||||
|
// gin::Debug::SetCodeRangeCreatedCallback only runs the callback when
|
||||||
|
// Isolate is just created, so we have to manually run following code here.
|
||||||
|
void* code_range = nullptr;
|
||||||
|
size_t size = 0;
|
||||||
|
v8::Isolate::GetCurrent()->GetCodeRange(&code_range, &size);
|
||||||
|
if (code_range && size)
|
||||||
|
RegisterNonABICompliantCodeRange(code_range, size);
|
||||||
|
}
|
||||||
|
gin::Debug::SetCodeRangeDeletedCallback(UnregisterNonABICompliantCodeRange);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrashReporterWin::SetUploadParameters() {
|
void CrashReporterWin::SetUploadParameters() {
|
||||||
|
|
|
@ -17,9 +17,6 @@ template <typename T> struct DefaultSingletonTraits;
|
||||||
|
|
||||||
namespace crash_reporter {
|
namespace crash_reporter {
|
||||||
|
|
||||||
// Hook up V8 to breakpad.
|
|
||||||
void SetupV8CodeRangeHook();
|
|
||||||
|
|
||||||
class CrashReporterWin : public CrashReporter {
|
class CrashReporterWin : public CrashReporter {
|
||||||
public:
|
public:
|
||||||
static CrashReporterWin* GetInstance();
|
static CrashReporterWin* GetInstance();
|
||||||
|
|
Loading…
Reference in a new issue