
* refactor: avoid redundant GetIsolate() calls in NodeBindings::CreateEnvironment() Xref: https://chromium-review.googlesource.com/c/v8/v8/+/6563615 * refactor: use v8::Isolate::GetCurrent() in Initialize() methods * refactor: add v8::Isolate* arg to NodeBindings::CreateEnvironment() * fixup! refactor: use v8::Isolate::GetCurrent() in Initialize() methods * refactor: add v8::Isolate* arg to RendererClientBase::DidCreateScriptContext() * fixup! refactor: add v8::Isolate* arg to NodeBindings::CreateEnvironment() * fixup! fixup! refactor: use v8::Isolate::GetCurrent() in Initialize() methods refactor: prefer JavascriptEnvironment::GetIsolate() in the browser layer
40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
// Copyright (c) 2022 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "shell/common/gin_helper/dictionary.h"
|
|
#include "shell/common/node_includes.h"
|
|
|
|
#if BUILDFLAG(IS_LINUX)
|
|
#include "components/crash/core/app/crashpad.h" // nogncheck
|
|
#endif
|
|
|
|
namespace {
|
|
|
|
#if BUILDFLAG(IS_LINUX)
|
|
int GetCrashdumpSignalFD() {
|
|
int fd;
|
|
return crash_reporter::GetHandlerSocket(&fd, nullptr) ? fd : -1;
|
|
}
|
|
|
|
int GetCrashpadHandlerPID() {
|
|
int pid;
|
|
return crash_reporter::GetHandlerSocket(nullptr, &pid) ? pid : -1;
|
|
}
|
|
#endif
|
|
|
|
void Initialize(v8::Local<v8::Object> exports,
|
|
v8::Local<v8::Value> unused,
|
|
v8::Local<v8::Context> context,
|
|
void* priv) {
|
|
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
|
gin_helper::Dictionary dict{isolate, exports};
|
|
#if BUILDFLAG(IS_LINUX)
|
|
dict.SetMethod("getCrashdumpSignalFD", &GetCrashdumpSignalFD);
|
|
dict.SetMethod("getCrashpadHandlerPID", &GetCrashpadHandlerPID);
|
|
#endif
|
|
}
|
|
|
|
} // namespace
|
|
|
|
NODE_LINKED_BINDING_CONTEXT_AWARE(electron_common_crashpad_support, Initialize)
|