Commit 2f9a9673 authored by Anna Henningsen's avatar Anna Henningsen Committed by Commit Bot

[api] Fix SuppressMicrotaskExecutionScope constructor

The overload taking a `MicrotaskQueue*` was introduced in
cce33f37 but never actually implemented.

This aligns the constructor signature to actually work, and
aligns it with e.g. `MicrotasksScope`. The previous signature
without an `Isolate*` argument would not work, because there’s
no pointer back from a MicrotaskQueue to the Isolate.

Refs: https://chromium-review.googlesource.com/c/v8/v8/+/1414950
Bug: v8:8124
Change-Id: I5dbaabef54c8de2b48f6172808825a186971524d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1879901Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64584}
parent e5dbc95c
......@@ -8045,8 +8045,8 @@ class V8_EXPORT Isolate {
*/
class V8_EXPORT SuppressMicrotaskExecutionScope {
public:
explicit SuppressMicrotaskExecutionScope(Isolate* isolate);
explicit SuppressMicrotaskExecutionScope(MicrotaskQueue* microtask_queue);
explicit SuppressMicrotaskExecutionScope(
Isolate* isolate, MicrotaskQueue* microtask_queue = nullptr);
~SuppressMicrotaskExecutionScope();
// Prevent copying of Scope objects.
......
......@@ -8408,9 +8408,11 @@ Isolate::AllowJavascriptExecutionScope::~AllowJavascriptExecutionScope() {
}
Isolate::SuppressMicrotaskExecutionScope::SuppressMicrotaskExecutionScope(
Isolate* isolate)
Isolate* isolate, MicrotaskQueue* microtask_queue)
: isolate_(reinterpret_cast<i::Isolate*>(isolate)),
microtask_queue_(isolate_->default_microtask_queue()) {
microtask_queue_(microtask_queue
? static_cast<i::MicrotaskQueue*>(microtask_queue)
: isolate_->default_microtask_queue()) {
isolate_->thread_local_top()->IncrementCallDepth(this);
microtask_queue_->IncrementMicrotasksSuppressions();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment