Skip to content

Commit

Permalink
fix: pipe-stdio stderr test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
ckerr committed Jun 17, 2023
1 parent 93d00f0 commit 4172fca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
10 changes: 4 additions & 6 deletions shell/browser/javascript_environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -333,16 +333,14 @@ void JavascriptEnvironment::CreateMicrotasksRunner() {
void JavascriptEnvironment::DestroyMicrotasksRunner() {
DCHECK(microtasks_runner_);
microtasks_runner_->PerformCheckpoint();
DestroyTrackedObjects();
{
v8::HandleScope scope(isolate_);
gin_helper::CleanedUpAtExit::DoCleanup();
}
base::CurrentThread::Get()->RemoveTaskObserver(microtasks_runner_.get());
microtasks_runner_.reset();
}

void JavascriptEnvironment::DestroyTrackedObjects() {
v8::HandleScope scope(isolate_);
gin_helper::CleanedUpAtExit::DoCleanup();
}

NodeEnvironment::NodeEnvironment(node::Environment* env) : env_(env) {}

NodeEnvironment::~NodeEnvironment() {
Expand Down
3 changes: 0 additions & 3 deletions shell/browser/javascript_environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ class JavascriptEnvironment {

private:
v8::Isolate* Initialize(uv_loop_t* event_loop, bool setup_wasm_streaming);

void DestroyTrackedObjects();

std::unique_ptr<node::MultiIsolatePlatform> platform_;

raw_ptr<v8::Isolate> isolate_;
Expand Down
6 changes: 3 additions & 3 deletions shell/browser/microtasks_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ void MicrotasksRunner::PerformCheckpoint() {
// https://github.com/electron/electron/issues/20013 Node.js now performs its
// own microtask checkpoint and it may happen is some situations that there is
// contention for performing checkpoint between Node.js and chromium, ending
// up Node.js delaying its callbacks. Here, we'll ensure those get called
// by creating a temporary node::CallbackScope, which performs a checkpoint
// when it goes out-of-scope.
// up Node.js delaying its callbacks. To fix this, now we always let Node.js
// handle the checkpoint in the browser process.
// node::CallbackScope performs the checkpoint when it goes out of scope.
v8::Isolate::Scope scope(isolate_);
v8::HandleScope handle_scope(isolate_);
node::CallbackScope microtasks_scope(isolate_, v8::Object::New(isolate_),
Expand Down

0 comments on commit 4172fca

Please sign in to comment.