Commit 9fc0fbf1 authored by tzik's avatar tzik Committed by Commit Bot

Use default MicrotaskQueue for MicrotasksScope when nullptr is given

After this CL, MicrotasksScope allows null MicrotaskQueue parameter,
so that the user can migrate one-by-one from the default microtask
queue to the finer grained one.

Change-Id: Id519920a9d57e80e279026ad05a14422fb72b050
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1559678Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60864}
parent 9ace845f
...@@ -8944,16 +8944,15 @@ std::unique_ptr<MicrotaskQueue> MicrotaskQueue::New(Isolate* isolate, ...@@ -8944,16 +8944,15 @@ std::unique_ptr<MicrotaskQueue> MicrotaskQueue::New(Isolate* isolate,
} }
MicrotasksScope::MicrotasksScope(Isolate* isolate, MicrotasksScope::Type type) MicrotasksScope::MicrotasksScope(Isolate* isolate, MicrotasksScope::Type type)
: MicrotasksScope( : MicrotasksScope(isolate, nullptr, type) {}
isolate,
reinterpret_cast<i::Isolate*>(isolate)->default_microtask_queue(),
type) {}
MicrotasksScope::MicrotasksScope(Isolate* isolate, MicrotasksScope::MicrotasksScope(Isolate* isolate,
MicrotaskQueue* microtask_queue, MicrotaskQueue* microtask_queue,
MicrotasksScope::Type type) MicrotasksScope::Type type)
: isolate_(reinterpret_cast<i::Isolate*>(isolate)), : isolate_(reinterpret_cast<i::Isolate*>(isolate)),
microtask_queue_(static_cast<i::MicrotaskQueue*>(microtask_queue)), microtask_queue_(microtask_queue
? static_cast<i::MicrotaskQueue*>(microtask_queue)
: isolate_->default_microtask_queue()),
run_(type == MicrotasksScope::kRunMicrotasks) { run_(type == MicrotasksScope::kRunMicrotasks) {
if (run_) microtask_queue_->IncrementMicrotasksScopeDepth(); if (run_) microtask_queue_->IncrementMicrotasksScopeDepth();
#ifdef DEBUG #ifdef DEBUG
......
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