2020-06-17 17:08:10 +00:00
|
|
|
// 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"
|
|
|
|
|
2023-04-20 00:27:02 +00:00
|
|
|
#include "shell/common/process_util.h"
|
2020-06-17 17:08:10 +00:00
|
|
|
|
|
|
|
namespace gin_helper {
|
|
|
|
|
|
|
|
MicrotasksScope::MicrotasksScope(v8::Isolate* isolate,
|
2023-01-11 16:59:32 +00:00
|
|
|
v8::MicrotaskQueue* microtask_queue,
|
2021-05-14 01:21:36 +00:00
|
|
|
bool ignore_browser_checkpoint,
|
|
|
|
v8::MicrotasksScope::Type scope_type) {
|
2023-04-20 00:27:02 +00:00
|
|
|
if (electron::IsBrowserProcess()) {
|
2020-06-17 17:08:10 +00:00
|
|
|
if (!ignore_browser_checkpoint)
|
|
|
|
v8::MicrotasksScope::PerformCheckpoint(isolate);
|
|
|
|
} else {
|
2023-01-11 16:59:32 +00:00
|
|
|
v8_microtasks_scope_ = std::make_unique<v8::MicrotasksScope>(
|
|
|
|
isolate, microtask_queue, scope_type);
|
2020-06-17 17:08:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MicrotasksScope::~MicrotasksScope() = default;
|
|
|
|
|
|
|
|
} // namespace gin_helper
|