7cc780d077
* fix: let Node.js perform microtask checkpoint in the main process * fix: don't specify v8::MicrotasksScope for explicit policy * fix: remove checkpoint from some call-sites We already perform checkpoint at the end of a task, either through MicrotaskRunner or through NodeBindings. There isn't a need to add them again when calling into JS except when dealing with promises. * fix: remove checkpoint from some call-sites We already perform checkpoint at the end of a task, either through MicrotaskRunner or through NodeBindings. There isn't a need to add them again when calling into JS except when dealing with promises. * fix incorrect specs * default constructor arguments are considered for explicit mark * add regression spec
24 lines
723 B
C++
24 lines
723 B
C++
// Copyright (c) 2020 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/microtasks_scope.h"
|
|
|
|
#include "shell/common/gin_helper/locker.h"
|
|
|
|
namespace gin_helper {
|
|
|
|
MicrotasksScope::MicrotasksScope(v8::Isolate* isolate,
|
|
bool ignore_browser_checkpoint) {
|
|
if (Locker::IsBrowserProcess()) {
|
|
if (!ignore_browser_checkpoint)
|
|
v8::MicrotasksScope::PerformCheckpoint(isolate);
|
|
} else {
|
|
v8_microtasks_scope_ = std::make_unique<v8::MicrotasksScope>(
|
|
isolate, v8::MicrotasksScope::kRunMicrotasks);
|
|
}
|
|
}
|
|
|
|
MicrotasksScope::~MicrotasksScope() = default;
|
|
|
|
} // namespace gin_helper
|