2020-06-17 10:08:10 -07: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 08:34:31 +01:00
|
|
|
#ifndef ELECTRON_SHELL_COMMON_GIN_HELPER_MICROTASKS_SCOPE_H_
|
|
|
|
#define ELECTRON_SHELL_COMMON_GIN_HELPER_MICROTASKS_SCOPE_H_
|
2020-06-17 10:08:10 -07:00
|
|
|
|
2024-09-09 11:51:42 -05:00
|
|
|
#include <optional>
|
2020-06-17 10:08:10 -07:00
|
|
|
|
2024-07-29 12:42:57 -05:00
|
|
|
#include "v8/include/v8-forward.h"
|
|
|
|
#include "v8/include/v8-microtask-queue.h"
|
2020-06-17 10:08:10 -07:00
|
|
|
|
|
|
|
namespace gin_helper {
|
|
|
|
|
|
|
|
// In the browser process runs v8::MicrotasksScope::PerformCheckpoint
|
|
|
|
// In the render process creates a v8::MicrotasksScope.
|
|
|
|
class MicrotasksScope {
|
|
|
|
public:
|
2024-08-05 08:24:27 -05:00
|
|
|
MicrotasksScope(v8::Isolate* isolate,
|
|
|
|
v8::MicrotaskQueue* microtask_queue,
|
|
|
|
bool ignore_browser_checkpoint,
|
|
|
|
v8::MicrotasksScope::Type scope_type);
|
2020-06-17 10:08:10 -07:00
|
|
|
~MicrotasksScope();
|
|
|
|
|
2021-11-03 12:41:45 +01:00
|
|
|
// disable copy
|
|
|
|
MicrotasksScope(const MicrotasksScope&) = delete;
|
|
|
|
MicrotasksScope& operator=(const MicrotasksScope&) = delete;
|
|
|
|
|
2020-06-17 10:08:10 -07:00
|
|
|
private:
|
2024-09-09 11:51:42 -05:00
|
|
|
std::optional<v8::MicrotasksScope> v8_microtasks_scope_;
|
2020-06-17 10:08:10 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gin_helper
|
|
|
|
|
2021-11-22 08:34:31 +01:00
|
|
|
#endif // ELECTRON_SHELL_COMMON_GIN_HELPER_MICROTASKS_SCOPE_H_
|