From b266b5208a40b58c7aafbfac35f65b528dbd39b8 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 15 Dec 2020 11:39:25 -0800 Subject: [PATCH] refactor: use public node::CallbackScope where possible (#27001) * refactor: use public node::CallbackScope where possible * Remove unused node_env() getter --- shell/browser/electron_browser_main_parts.h | 1 - shell/browser/microtasks_runner.cc | 6 ++---- shell/common/api/electron_bindings.cc | 5 ++--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/shell/browser/electron_browser_main_parts.h b/shell/browser/electron_browser_main_parts.h index b6e357b49063..c34a74101801 100644 --- a/shell/browser/electron_browser_main_parts.h +++ b/shell/browser/electron_browser_main_parts.h @@ -89,7 +89,6 @@ class ElectronBrowserMainParts : public content::BrowserMainParts { Browser* browser() { return browser_.get(); } BrowserProcessImpl* browser_process() { return fake_browser_process_.get(); } - NodeEnvironment* node_env() { return node_env_.get(); } protected: // content::BrowserMainParts: diff --git a/shell/browser/microtasks_runner.cc b/shell/browser/microtasks_runner.cc index 0bb9baacc5d4..d00990de67d8 100644 --- a/shell/browser/microtasks_runner.cc +++ b/shell/browser/microtasks_runner.cc @@ -29,11 +29,9 @@ void MicrotasksRunner::DidProcessTask(const base::PendingTask& pending_task) { // up Node.js dealying its callbacks. To fix this, now we always lets Node.js // handle the checkpoint in the browser process. { - auto* node_env = electron::ElectronBrowserMainParts::Get()->node_env(); v8::HandleScope scope(isolate_); - node::InternalCallbackScope microtasks_scope( - node_env->env(), v8::Object::New(isolate_), {0, 0}, - node::InternalCallbackScope::kNoFlags); + node::CallbackScope microtasks_scope(isolate_, v8::Object::New(isolate_), + {0, 0}); } } diff --git a/shell/common/api/electron_bindings.cc b/shell/common/api/electron_bindings.cc index d043980e8dff..85fba109a1c8 100644 --- a/shell/common/api/electron_bindings.cc +++ b/shell/common/api/electron_bindings.cc @@ -113,9 +113,8 @@ void ElectronBindings::OnCallNextTick(uv_async_t* handle) { gin_helper::Locker locker(env->isolate()); v8::Context::Scope context_scope(env->context()); v8::HandleScope handle_scope(env->isolate()); - node::InternalCallbackScope scope(env, v8::Object::New(env->isolate()), - {0, 0}, - node::InternalCallbackScope::kNoFlags); + node::CallbackScope scope(env->isolate(), v8::Object::New(env->isolate()), + {0, 0}); } self->pending_next_ticks_.clear();