Browse Source

refactor: use public node::CallbackScope where possible (#27027)

* refactor: use public node::CallbackScope where possible

* Remove unused node_env() getter

Co-authored-by: Shelley Vohr <[email protected]>
trop[bot] 4 years ago
parent
commit
eebd7cfa05

+ 0 - 1
shell/browser/electron_browser_main_parts.h

@@ -90,7 +90,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:

+ 2 - 4
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});
   }
 }
 

+ 2 - 3
shell/common/api/electron_bindings.cc

@@ -115,9 +115,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();