DescriptionSimplify Blink <-> V8 Microtask queue running protocol
V8 now implements Isolate::RunMicrotasks() in C++, which means its callers
no longer need to enter V8 Context::Scope before calling it. This simplifies
WebCore::Microtask::performCheckpoint, and gets us one step closer to ditching
V8PerIsolateData::ensureDomInJSContext().
This patch also gets rid of most of the microtask-related logic in
ScriptPromiseResolverWithContext, allowing WebCore::Microtask::performCheckpoint
to be the only code in Blink that calls Isolate::RunMicrotasks().
Instead of triggering microtask delivery directly, or via the RunMicrotasksTask,
ScriptPromiseResolverWithContext now utilizes V8RecursionScope to "simulate"
a JavaScript stack (from Blink's point of view). In workers, this will
result in a RunMicrotasks() call when the V8RecursionScope is destructed.
There are still two FIXMEs:
- The V8RecursionScope discussed above would be unnecessary if there were
a WebThread::TaskObserver on worker threads to handle microtask-running
at the end of each task.
- ensureDomInJSContext() is still needed in order to instantiate the v8::Functions
that are passed into Isolate::EnqueueMicrotask(). Fixing this will require
more work on the V8 side to allow passing in a C++ callback directly.
BUG=374772
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=174987
Patch Set 1 #
Messages
Total messages: 8 (0 generated)
|