refactor: add EmitWarning(v8::Isolate*) helper (#43722)

* refactor: add EmitWarning(Isolate*, ...) warning

* chore: remove EmitWarning(node::Environment*, ...)

* chore: add code comments

* fixup! refactor: add EmitWarning(Isolate*, ...) warning

* chore: remove unused node #includes
This commit is contained in:
Charles Kerr 2024-09-16 15:53:04 -05:00 committed by GitHub
parent 7d4f202c1c
commit 05dfd14913
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 72 additions and 89 deletions

View file

@ -15,7 +15,7 @@
#include "shell/common/gin_converters/gfx_converter.h"
#include "shell/common/gin_converters/optional_converter.h"
#include "shell/common/node_includes.h"
#include "shell/common/process_util.h"
#include "shell/common/node_util.h"
namespace gin {
@ -146,13 +146,11 @@ v8::Local<v8::Value> Converter<electron::OffscreenSharedTextureValue>::ToV8(
data.SetSecondPassCallback([](const v8::WeakCallbackInfo<
OffscreenReleaseHolderMonitor>& data) {
auto* iso = data.GetIsolate();
node::Environment* env = node::Environment::GetCurrent(iso);
// Emit warning only once
static std::once_flag flag;
std::call_once(flag, [=] {
electron::EmitWarning(
env,
electron::util::EmitWarning(
iso,
"[OSR TEXTURE LEAKED] When using OSR with "
"`useSharedTexture`, `texture.release()` "
"must be called explicitly as soon as the texture is "