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

Namespaces

namespace  tracing
 

Classes

class  DefaultForegroundTaskRunner
 
class  DefaultJobHandle
 
class  DefaultJobState
 
class  DefaultJobWorker
 
class  DefaultPlatform
 
class  DefaultThreadIsolatedAllocator
 
class  DefaultWorkerThreadsTaskRunner
 
class  DelayedTaskQueue
 
class  TaskQueue
 
class  WorkerThread
 

Enumerations

enum class  IdleTaskSupport { kDisabled , kEnabled }
 
enum class  InProcessStackDumping { kDisabled , kEnabled }
 
enum class  MessageLoopBehavior : bool { kDoNotWait = false , kWaitForWork = true }
 
enum class  PriorityMode : bool { kDontApply , kApply }
 

Functions

std::unique_ptr< v8::PlatformNewDefaultPlatform (int thread_pool_size, IdleTaskSupport idle_task_support, InProcessStackDumping in_process_stack_dumping, std::unique_ptr< v8::TracingController > tracing_controller, PriorityMode priority_mode)
 
std::unique_ptr< v8::PlatformNewSingleThreadedDefaultPlatform (IdleTaskSupport idle_task_support, InProcessStackDumping in_process_stack_dumping, std::unique_ptr< v8::TracingController > tracing_controller)
 
V8_PLATFORM_EXPORT std::unique_ptr< JobHandleNewDefaultJobHandle (Platform *platform, TaskPriority priority, std::unique_ptr< JobTask > job_task, size_t num_worker_threads)
 
bool PumpMessageLoop (v8::Platform *platform, v8::Isolate *isolate, MessageLoopBehavior behavior)
 
void RunIdleTasks (v8::Platform *platform, v8::Isolate *isolate, double idle_time_in_seconds)
 
void NotifyIsolateShutdown (v8::Platform *platform, Isolate *isolate)
 

Enumeration Type Documentation

◆ IdleTaskSupport

enum class v8::platform::IdleTaskSupport
strong
Enumerator
kDisabled 
kEnabled 

Definition at line 18 of file libplatform.h.

◆ InProcessStackDumping

Enumerator
kDisabled 
kEnabled 

Definition at line 19 of file libplatform.h.

◆ MessageLoopBehavior

enum class v8::platform::MessageLoopBehavior : bool
strong
Enumerator
kDoNotWait 
kWaitForWork 

Definition at line 21 of file libplatform.h.

◆ PriorityMode

enum class v8::platform::PriorityMode : bool
strong
Enumerator
kDontApply 
kApply 

Definition at line 26 of file libplatform.h.

Function Documentation

◆ NewDefaultJobHandle()

V8_PLATFORM_EXPORT std::unique_ptr< v8::JobHandle > v8::platform::NewDefaultJobHandle ( v8::Platform * platform,
v8::TaskPriority priority,
std::unique_ptr< v8::JobTask > job_task,
size_t num_worker_threads )

Returns a new instance of the default v8::JobHandle implementation.

The job will be executed by spawning up to |num_worker_threads| many worker threads on the provided |platform| with the given |priority|.

Definition at line 72 of file default-platform.cc.

Here is the caller graph for this function:

◆ NewDefaultPlatform()

V8_PLATFORM_EXPORT std::unique_ptr< v8::Platform > v8::platform::NewDefaultPlatform ( int thread_pool_size = 0,
IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled,
InProcessStackDumping in_process_stack_dumping = InProcessStackDumping::kDisabled,
std::unique_ptr< v8::TracingController > tracing_controller = {},
PriorityMode priority_mode = PriorityMode::kDontApply )

Returns a new instance of the default v8::Platform implementation.

The caller will take ownership of the returned pointer. |thread_pool_size| is the number of worker threads to allocate for background jobs. If a value of zero is passed, a suitable default based on the current number of processors online will be chosen. If |idle_task_support| is enabled then the platform will accept idle tasks (IdleTasksEnabled will return true) and will rely on the embedder calling v8::platform::RunIdleTasks to process the idle tasks. If |tracing_controller| is nullptr, the default platform will create a v8::platform::TracingController instance and use it. If |priority_mode| is PriorityMode::kApply, the default platform will use multiple task queues executed by threads different system-level priorities (where available) to schedule tasks.

Definition at line 45 of file default-platform.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NewSingleThreadedDefaultPlatform()

V8_PLATFORM_EXPORT std::unique_ptr< v8::Platform > v8::platform::NewSingleThreadedDefaultPlatform ( IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled,
InProcessStackDumping in_process_stack_dumping = InProcessStackDumping::kDisabled,
std::unique_ptr< v8::TracingController > tracing_controller = {} )

The same as NewDefaultPlatform but disables the worker thread pool. It must be used with the –single-threaded V8 flag.

Definition at line 60 of file default-platform.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NotifyIsolateShutdown()

V8_PLATFORM_EXPORT void v8::platform::NotifyIsolateShutdown ( v8::Platform * platform,
Isolate * isolate )

Notifies the given platform about the Isolate getting deleted soon. Has to be called for all Isolates which are deleted - unless we're shutting down the platform.

The |platform| has to be created using |NewDefaultPlatform|.

Definition at line 91 of file default-platform.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PumpMessageLoop()

V8_PLATFORM_EXPORT bool v8::platform::PumpMessageLoop ( v8::Platform * platform,
v8::Isolate * isolate,
MessageLoopBehavior behavior = MessageLoopBehavior::kDoNotWait )

Pumps the message loop for the given isolate.

The caller has to make sure that this is called from the right thread. Returns true if a task was executed, and false otherwise. If the call to PumpMessageLoop is nested within another call to PumpMessageLoop, only nestable tasks may run. Otherwise, any task may run. Unless requested through the |behavior| parameter, this call does not block if no task is pending. The |platform| has to be created using |NewDefaultPlatform|.

Definition at line 79 of file default-platform.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RunIdleTasks()

V8_PLATFORM_EXPORT void v8::platform::RunIdleTasks ( v8::Platform * platform,
v8::Isolate * isolate,
double idle_time_in_seconds )

Runs pending idle tasks for at most |idle_time_in_seconds| seconds.

The caller has to make sure that this is called from the right thread. This call does not block if no task is pending. The |platform| has to be created using |NewDefaultPlatform|.

Definition at line 85 of file default-platform.cc.

Here is the call graph for this function:
Here is the caller graph for this function: