v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8::DelayedTasksPlatform Class Referencefinal
Inheritance diagram for v8::DelayedTasksPlatform:
Collaboration diagram for v8::DelayedTasksPlatform:

Classes

class  DelayedIdleTask
 
class  DelayedJob
 
class  DelayedTask
 
class  DelayedTaskRunner
 

Public Member Functions

 DelayedTasksPlatform (std::unique_ptr< Platform > platform)
 
 DelayedTasksPlatform (std::unique_ptr< Platform > platform, int64_t random_seed)
 
 DelayedTasksPlatform (const DelayedTasksPlatform &)=delete
 
DelayedTasksPlatformoperator= (const DelayedTasksPlatform &)=delete
 
 ~DelayedTasksPlatform () override
 
PageAllocatorGetPageAllocator () override
 
void OnCriticalMemoryPressure () override
 
std::shared_ptr< TaskRunnerGetForegroundTaskRunner (v8::Isolate *isolate, TaskPriority priority) override
 
int NumberOfWorkerThreads () override
 
void PostTaskOnWorkerThreadImpl (TaskPriority priority, std::unique_ptr< Task > task, const SourceLocation &location) override
 
void PostDelayedTaskOnWorkerThreadImpl (TaskPriority priority, std::unique_ptr< Task > task, double delay_in_seconds, const SourceLocation &location) override
 
bool IdleTasksEnabled (Isolate *isolate) override
 
std::unique_ptr< JobHandleCreateJobImpl (TaskPriority priority, std::unique_ptr< JobTask > job_task, const SourceLocation &location) override
 
double MonotonicallyIncreasingTime () override
 
double CurrentClockTimeMillis () override
 
v8::TracingControllerGetTracingController () override
 
- Public Member Functions inherited from v8::Platform
virtual ~Platform ()=default
 
virtual ThreadIsolatedAllocatorGetThreadIsolatedAllocator ()
 
std::shared_ptr< v8::TaskRunnerGetForegroundTaskRunner (Isolate *isolate)
 
void CallOnWorkerThread (std::unique_ptr< Task > task, const SourceLocation &location=SourceLocation::Current())
 
void CallBlockingTaskOnWorkerThread (std::unique_ptr< Task > task, const SourceLocation &location=SourceLocation::Current())
 
void CallLowPriorityTaskOnWorkerThread (std::unique_ptr< Task > task, const SourceLocation &location=SourceLocation::Current())
 
void CallDelayedOnWorkerThread (std::unique_ptr< Task > task, double delay_in_seconds, const SourceLocation &location=SourceLocation::Current())
 
void PostTaskOnWorkerThread (TaskPriority priority, std::unique_ptr< Task > task, const SourceLocation &location=SourceLocation::Current())
 
void PostDelayedTaskOnWorkerThread (TaskPriority priority, std::unique_ptr< Task > task, double delay_in_seconds, const SourceLocation &location=SourceLocation::Current())
 
std::unique_ptr< JobHandlePostJob (TaskPriority priority, std::unique_ptr< JobTask > job_task, const SourceLocation &location=SourceLocation::Current())
 
std::unique_ptr< JobHandleCreateJob (TaskPriority priority, std::unique_ptr< JobTask > job_task, const SourceLocation &location=SourceLocation::Current())
 
virtual std::unique_ptr< ScopedBlockingCallCreateBlockingScope (BlockingType blocking_type)
 
virtual int64_t CurrentClockTimeMilliseconds ()
 
virtual double CurrentClockTimeMillisecondsHighResolution ()
 
virtual StackTracePrinter GetStackTracePrinter ()
 
virtual void DumpWithoutCrashing ()
 
virtual HighAllocationThroughputObserverGetHighAllocationThroughputObserver ()
 

Private Member Functions

int32_t GetRandomDelayInMilliseconds ()
 
std::unique_ptr< TaskMakeDelayedTask (std::unique_ptr< Task > task)
 
std::unique_ptr< IdleTaskMakeDelayedIdleTask (std::unique_ptr< IdleTask > task)
 
std::unique_ptr< JobTaskMakeDelayedJob (std::unique_ptr< JobTask > task)
 

Private Attributes

std::unique_ptr< Platformplatform_
 
base::Mutex mutex_
 
base::RandomNumberGenerator rng_
 
std::unordered_map< TaskRunner *, std::weak_ptr< DelayedTaskRunner > > delayed_task_runners_
 

Additional Inherited Members

- Public Types inherited from v8::Platform
typedef void(*) StackTracePrinter()
 
- Protected Member Functions inherited from v8::Platform
- Static Protected Member Functions inherited from v8::Platform
static V8_EXPORT double SystemClockTimeMillis ()
 

Detailed Description

Definition at line 117 of file d8-platforms.cc.

Constructor & Destructor Documentation

◆ DelayedTasksPlatform() [1/3]

v8::DelayedTasksPlatform::DelayedTasksPlatform ( std::unique_ptr< Platform > platform)
inlineexplicit

Definition at line 119 of file d8-platforms.cc.

◆ DelayedTasksPlatform() [2/3]

v8::DelayedTasksPlatform::DelayedTasksPlatform ( std::unique_ptr< Platform > platform,
int64_t random_seed )
inlineexplicit

Definition at line 124 of file d8-platforms.cc.

◆ DelayedTasksPlatform() [3/3]

v8::DelayedTasksPlatform::DelayedTasksPlatform ( const DelayedTasksPlatform & )
delete

◆ ~DelayedTasksPlatform()

v8::DelayedTasksPlatform::~DelayedTasksPlatform ( )
inlineoverride

Definition at line 133 of file d8-platforms.cc.

Member Function Documentation

◆ CreateJobImpl()

std::unique_ptr< JobHandle > v8::DelayedTasksPlatform::CreateJobImpl ( TaskPriority priority,
std::unique_ptr< JobTask > job_task,
const SourceLocation & location )
inlineoverridevirtual

Creates and returns a JobHandle associated with a Job.

Implements v8::Platform.

Definition at line 189 of file d8-platforms.cc.

Here is the call graph for this function:

◆ CurrentClockTimeMillis()

double v8::DelayedTasksPlatform::CurrentClockTimeMillis ( )
inlineoverridevirtual

This function is deprecated and will be deleted. Use either CurrentClockTimeMilliseconds() or CurrentClockTimeMillisecondsHighResolution().

Implements v8::Platform.

Definition at line 200 of file d8-platforms.cc.

◆ GetForegroundTaskRunner()

std::shared_ptr< TaskRunner > v8::DelayedTasksPlatform::GetForegroundTaskRunner ( v8::Isolate * isolate,
TaskPriority priority )
inlineoverridevirtual

Returns a TaskRunner with a specific |priority| which can be used to post a task on the foreground thread. The TaskRunner's NonNestableTasksEnabled() must be true. This function should only be called from a foreground thread.

Implements v8::Platform.

Definition at line 146 of file d8-platforms.cc.

◆ GetPageAllocator()

PageAllocator * v8::DelayedTasksPlatform::GetPageAllocator ( )
inlineoverridevirtual

Allows the embedder to manage memory page allocations. Returning nullptr will cause V8 to use the default page allocator.

Reimplemented from v8::Platform.

Definition at line 138 of file d8-platforms.cc.

◆ GetRandomDelayInMilliseconds()

int32_t v8::DelayedTasksPlatform::GetRandomDelayInMilliseconds ( )
inlineprivate

Definition at line 323 of file d8-platforms.cc.

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

◆ GetTracingController()

v8::TracingController * v8::DelayedTasksPlatform::GetTracingController ( )
inlineoverridevirtual

Returns an instance of a v8::TracingController. This must be non-nullptr.

Implements v8::Platform.

Definition at line 204 of file d8-platforms.cc.

◆ IdleTasksEnabled()

bool v8::DelayedTasksPlatform::IdleTasksEnabled ( Isolate * isolate)
inlineoverridevirtual

Returns true if idle tasks are enabled for the given |isolate|.

Reimplemented from v8::Platform.

Definition at line 185 of file d8-platforms.cc.

◆ MakeDelayedIdleTask()

std::unique_ptr< IdleTask > v8::DelayedTasksPlatform::MakeDelayedIdleTask ( std::unique_ptr< IdleTask > task)
inlineprivate

Definition at line 336 of file d8-platforms.cc.

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

◆ MakeDelayedJob()

std::unique_ptr< JobTask > v8::DelayedTasksPlatform::MakeDelayedJob ( std::unique_ptr< JobTask > task)
inlineprivate

Definition at line 342 of file d8-platforms.cc.

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

◆ MakeDelayedTask()

std::unique_ptr< Task > v8::DelayedTasksPlatform::MakeDelayedTask ( std::unique_ptr< Task > task)
inlineprivate

Definition at line 331 of file d8-platforms.cc.

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

◆ MonotonicallyIncreasingTime()

double v8::DelayedTasksPlatform::MonotonicallyIncreasingTime ( )
inlineoverridevirtual

Monotonically increasing time in seconds from an arbitrary fixed point in the past. This function is expected to return at least millisecond-precision values. For this reason, it is recommended that the fixed point be no further in the past than the epoch.

Implements v8::Platform.

Definition at line 196 of file d8-platforms.cc.

◆ NumberOfWorkerThreads()

int v8::DelayedTasksPlatform::NumberOfWorkerThreads ( )
inlineoverridevirtual

Gets the max number of worker threads that may be used to execute concurrent work scheduled for any single TaskPriority by Call(BlockingTask)OnWorkerThread() or PostJob(). This can be used to estimate the number of tasks a work package should be split into. A return value of 0 means that there are no worker threads available. Note that a value of 0 won't prohibit V8 from posting tasks using |CallOnWorkerThread|.

Implements v8::Platform.

Definition at line 167 of file d8-platforms.cc.

◆ OnCriticalMemoryPressure()

void v8::DelayedTasksPlatform::OnCriticalMemoryPressure ( )
inlineoverridevirtual

Enables the embedder to respond in cases where V8 can't allocate large blocks of memory. V8 retries the failed allocation once after calling this method. On success, execution continues; otherwise V8 exits with a fatal error. Embedder overrides of this function must NOT call back into V8.

Reimplemented from v8::Platform.

Definition at line 142 of file d8-platforms.cc.

◆ operator=()

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

◆ PostDelayedTaskOnWorkerThreadImpl()

void v8::DelayedTasksPlatform::PostDelayedTaskOnWorkerThreadImpl ( TaskPriority priority,
std::unique_ptr< Task > task,
double delay_in_seconds,
const SourceLocation & location )
inlineoverridevirtual

Schedules a task with |priority| to be invoked on a worker thread after |delay_in_seconds| expires.

Implements v8::Platform.

Definition at line 178 of file d8-platforms.cc.

Here is the call graph for this function:

◆ PostTaskOnWorkerThreadImpl()

void v8::DelayedTasksPlatform::PostTaskOnWorkerThreadImpl ( TaskPriority priority,
std::unique_ptr< Task > task,
const SourceLocation & location )
inlineoverridevirtual

Schedules a task with |priority| to be invoked on a worker thread.

Implements v8::Platform.

Definition at line 171 of file d8-platforms.cc.

Here is the call graph for this function:

Member Data Documentation

◆ delayed_task_runners_

std::unordered_map<TaskRunner*, std::weak_ptr<DelayedTaskRunner> > v8::DelayedTasksPlatform::delayed_task_runners_
private

Definition at line 321 of file d8-platforms.cc.

◆ mutex_

base::Mutex v8::DelayedTasksPlatform::mutex_
private

Definition at line 318 of file d8-platforms.cc.

◆ platform_

std::unique_ptr<Platform> v8::DelayedTasksPlatform::platform_
private

Definition at line 313 of file d8-platforms.cc.

◆ rng_

base::RandomNumberGenerator v8::DelayedTasksPlatform::rng_
private

Definition at line 319 of file d8-platforms.cc.


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