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.
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#ifndef ELECTRON_SHELL_COMMON_GIN_HELPER_MICROTASKS_SCOPE_H_
|
|
|
|
#define ELECTRON_SHELL_COMMON_GIN_HELPER_MICROTASKS_SCOPE_H_
|
2020-06-17 17:08:10 +00:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "v8/include/v8.h"
|
|
|
|
|
|
|
|
namespace gin_helper {
|
|
|
|
|
|
|
|
// In the browser process runs v8::MicrotasksScope::PerformCheckpoint
|
|
|
|
// In the render process creates a v8::MicrotasksScope.
|
|
|
|
class MicrotasksScope {
|
|
|
|
public:
|
|
|
|
explicit 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 = false,
|
|
|
|
v8::MicrotasksScope::Type scope_type =
|
|
|
|
v8::MicrotasksScope::kRunMicrotasks);
|
2020-06-17 17:08:10 +00:00
|
|
|
~MicrotasksScope();
|
|
|
|
|
2021-11-03 11:41:45 +00:00
|
|
|
// disable copy
|
|
|
|
MicrotasksScope(const MicrotasksScope&) = delete;
|
|
|
|
MicrotasksScope& operator=(const MicrotasksScope&) = delete;
|
|
|
|
|
2020-06-17 17:08:10 +00:00
|
|
|
private:
|
|
|
|
std::unique_ptr<v8::MicrotasksScope> v8_microtasks_scope_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gin_helper
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#endif // ELECTRON_SHELL_COMMON_GIN_HELPER_MICROTASKS_SCOPE_H_
|