Only register code range once
This commit is contained in:
parent
7c1f48808b
commit
8956388804
2 changed files with 10 additions and 7 deletions
|
@ -138,7 +138,8 @@ void UnregisterNonABICompliantCodeRange(void* start) {
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
CrashReporterWin::CrashReporterWin()
|
CrashReporterWin::CrashReporterWin()
|
||||||
: skip_system_crash_handler_(false) {
|
: skip_system_crash_handler_(false),
|
||||||
|
code_range_registered_(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CrashReporterWin::~CrashReporterWin() {
|
CrashReporterWin::~CrashReporterWin() {
|
||||||
|
@ -189,19 +190,20 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
|
||||||
LOG(ERROR) << "Cannot initialize out-of-process crash handler";
|
LOG(ERROR) << "Cannot initialize out-of-process crash handler";
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
bool registered = false;
|
|
||||||
// Hook up V8 to breakpad.
|
// Hook up V8 to breakpad.
|
||||||
{
|
if (!code_range_registered_) {
|
||||||
// gin::Debug::SetCodeRangeCreatedCallback only runs the callback when
|
// gin::Debug::SetCodeRangeCreatedCallback only runs the callback when
|
||||||
// Isolate is just created, so we have to manually run following code here.
|
// Isolate is just created, so we have to manually run following code here.
|
||||||
void* code_range = nullptr;
|
void* code_range = nullptr;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
v8::Isolate::GetCurrent()->GetCodeRange(&code_range, &size);
|
v8::Isolate::GetCurrent()->GetCodeRange(&code_range, &size);
|
||||||
if (code_range && size)
|
if (code_range && size &&
|
||||||
registered = RegisterNonABICompliantCodeRange(code_range, size);
|
RegisterNonABICompliantCodeRange(code_range, size)) {
|
||||||
|
code_range_registered_ = true;
|
||||||
|
gin::Debug::SetCodeRangeDeletedCallback(
|
||||||
|
UnregisterNonABICompliantCodeRange);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (registered)
|
|
||||||
gin::Debug::SetCodeRangeDeletedCallback(UnregisterNonABICompliantCodeRange);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@ class CrashReporterWin : public CrashReporter {
|
||||||
google_breakpad::CustomClientInfo custom_info_;
|
google_breakpad::CustomClientInfo custom_info_;
|
||||||
|
|
||||||
bool skip_system_crash_handler_;
|
bool skip_system_crash_handler_;
|
||||||
|
bool code_range_registered_;
|
||||||
std::unique_ptr<google_breakpad::ExceptionHandler> breakpad_;
|
std::unique_ptr<google_breakpad::ExceptionHandler> breakpad_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CrashReporterWin);
|
DISALLOW_COPY_AND_ASSIGN(CrashReporterWin);
|
||||||
|
|
Loading…
Reference in a new issue