#[repr(C)]pub struct Platform(_);
Implementations§
source§impl Platform
impl Platform
sourcepub fn new(thread_pool_size: u32, idle_task_support: bool) -> UniqueRef<Self>
pub fn new(thread_pool_size: u32, idle_task_support: bool) -> UniqueRef<Self>
Returns a new instance of the default v8::Platform implementation.
|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.
sourcepub fn new_single_threaded(idle_task_support: bool) -> UniqueRef<Self>
pub fn new_single_threaded(idle_task_support: bool) -> UniqueRef<Self>
The same as new() but disables the worker thread pool. It must be used with the –single-threaded V8 flag.
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.
source§impl Platform
impl Platform
sourcepub fn pump_message_loop(
platform: &SharedRef<Self>,
isolate: &mut Isolate,
wait_for_work: bool
) -> bool
pub fn pump_message_loop(
platform: &SharedRef<Self>,
isolate: &mut Isolate,
wait_for_work: bool
) -> bool
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 |wait_for_work| parameter, this call does not block if no task is pending.
sourcepub fn run_idle_tasks(
platform: &SharedRef<Self>,
isolate: &mut Isolate,
idle_time_in_seconds: f64
)
pub fn run_idle_tasks(
platform: &SharedRef<Self>,
isolate: &mut Isolate,
idle_time_in_seconds: f64
)
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.