v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8::MicrotaskQueue Class Referenceabstract

#include <v8-microtask-queue.h>

Inheritance diagram for v8::MicrotaskQueue:
Collaboration diagram for v8::MicrotaskQueue:

Public Member Functions

virtual ~MicrotaskQueue ()=default
 
virtual void EnqueueMicrotask (Isolate *isolate, Local< Function > microtask)=0
 
virtual void EnqueueMicrotask (v8::Isolate *isolate, MicrotaskCallback callback, void *data=nullptr)=0
 
virtual void AddMicrotasksCompletedCallback (MicrotasksCompletedCallbackWithData callback, void *data=nullptr)=0
 
virtual void RemoveMicrotasksCompletedCallback (MicrotasksCompletedCallbackWithData callback, void *data=nullptr)=0
 
virtual void PerformCheckpoint (Isolate *isolate)=0
 
virtual bool IsRunningMicrotasks () const =0
 
virtual int GetMicrotasksScopeDepth () const =0
 
 MicrotaskQueue (const MicrotaskQueue &)=delete
 
MicrotaskQueueoperator= (const MicrotaskQueue &)=delete
 

Static Public Member Functions

static std::unique_ptr< MicrotaskQueueNew (Isolate *isolate, MicrotasksPolicy policy=MicrotasksPolicy::kAuto)
 

Private Member Functions

 MicrotaskQueue ()=default
 

Friends

class internal::MicrotaskQueue
 

Detailed Description

Represents the microtask queue, where microtasks are stored and processed. https://html.spec.whatwg.org/multipage/webappapis.html#microtask-queue https://html.spec.whatwg.org/multipage/webappapis.html#enqueuejob(queuename,-job,-arguments) https://html.spec.whatwg.org/multipage/webappapis.html#perform-a-microtask-checkpoint

A MicrotaskQueue instance may be associated to multiple Contexts by passing it to Context::New(), and they can be detached by Context::DetachGlobal(). The embedder must keep the MicrotaskQueue instance alive until all associated Contexts are gone or detached.

Use the same instance of MicrotaskQueue for all Contexts that may access each other synchronously. E.g. for Web embedding, use the same instance for all origins that share the same URL scheme and eTLD+1.

Definition at line 40 of file v8-microtask-queue.h.

Constructor & Destructor Documentation

◆ ~MicrotaskQueue()

virtual v8::MicrotaskQueue::~MicrotaskQueue ( )
virtualdefault

Reimplemented in v8::internal::MicrotaskQueue.

◆ MicrotaskQueue() [1/2]

◆ MicrotaskQueue() [2/2]

Member Function Documentation

◆ AddMicrotasksCompletedCallback()

virtual void v8::MicrotaskQueue::AddMicrotasksCompletedCallback ( MicrotasksCompletedCallbackWithData callback,
void * data = nullptr )
pure virtual

Adds a callback to notify the embedder after microtasks were run. The callback is triggered by explicit RunMicrotasks call or automatic microtasks execution (see Isolate::SetMicrotasksPolicy).

Callback will trigger even if microtasks were attempted to run, but the microtasks queue was empty and no single microtask was actually executed.

Executing scripts inside the callback will not re-trigger microtasks and the callback.

Implemented in v8::internal::MicrotaskQueue.

Here is the caller graph for this function:

◆ EnqueueMicrotask() [1/2]

virtual void v8::MicrotaskQueue::EnqueueMicrotask ( Isolate * isolate,
Local< Function > microtask )
pure virtual

Enqueues the callback to the queue.

Implemented in v8::internal::MicrotaskQueue.

◆ EnqueueMicrotask() [2/2]

virtual void v8::MicrotaskQueue::EnqueueMicrotask ( v8::Isolate * isolate,
MicrotaskCallback callback,
void * data = nullptr )
pure virtual

Enqueues the callback to the queue.

Implemented in v8::internal::MicrotaskQueue.

◆ GetMicrotasksScopeDepth()

virtual int v8::MicrotaskQueue::GetMicrotasksScopeDepth ( ) const
pure virtual

Returns the current depth of nested MicrotasksScope that has kRunMicrotasks.

Implemented in v8::internal::MicrotaskQueue.

◆ IsRunningMicrotasks()

virtual bool v8::MicrotaskQueue::IsRunningMicrotasks ( ) const
pure virtual

Returns true if a microtask is running on this MicrotaskQueue instance.

Implemented in v8::internal::MicrotaskQueue.

◆ New()

std::unique_ptr< MicrotaskQueue > v8::MicrotaskQueue::New ( Isolate * isolate,
MicrotasksPolicy policy = MicrotasksPolicy::kAuto )
static

Creates an empty MicrotaskQueue instance.

Definition at line 10966 of file api.cc.

◆ operator=()

MicrotaskQueue & v8::MicrotaskQueue::operator= ( const MicrotaskQueue & )
delete

◆ PerformCheckpoint()

virtual void v8::MicrotaskQueue::PerformCheckpoint ( Isolate * isolate)
pure virtual

Runs microtasks if no microtask is running on this MicrotaskQueue instance.

Implemented in v8::internal::MicrotaskQueue.

◆ RemoveMicrotasksCompletedCallback()

virtual void v8::MicrotaskQueue::RemoveMicrotasksCompletedCallback ( MicrotasksCompletedCallbackWithData callback,
void * data = nullptr )
pure virtual

Removes callback that was installed by AddMicrotasksCompletedCallback.

Implemented in v8::internal::MicrotaskQueue.

Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ internal::MicrotaskQueue

friend class internal::MicrotaskQueue
friend

Definition at line 104 of file v8-microtask-queue.h.


The documentation for this class was generated from the following files: