v8  9.4.146 (node 16.13.0)
V8 is Google's open source JavaScript engine
DefaultPlatform Class Reference

#include <default-platform.h>

Inheritance diagram for DefaultPlatform:
Collaboration diagram for DefaultPlatform:

Public Types

using IdleTaskSupport = v8::platform::IdleTaskSupport

Public Member Functions

 DefaultPlatform (int thread_pool_size=0, IdleTaskSupport idle_task_support=IdleTaskSupport::kDisabled, std::unique_ptr< TracingController > tracing_controller={})
cppgc::PageAllocatorGetPageAllocator () override
double MonotonicallyIncreasingTime () override
std::shared_ptr< cppgc::TaskRunnerGetForegroundTaskRunner () override
std::unique_ptr< cppgc::JobHandlePostJob (cppgc::TaskPriority priority, std::unique_ptr< cppgc::JobTask > job_task) override
TracingControllerGetTracingController () override
- Public Member Functions inherited from Platform
virtual ~Platform ()=default
virtual std::unique_ptr< JobHandlePostJob (TaskPriority priority, std::unique_ptr< JobTask > job_task)

Static Public Member Functions

static void InitializeProcess (DefaultPlatform *platform)
- Static Public Member Functions inherited from Platform
static constexpr bool StackAddressesSmallerThanHeapAddresses ()

Protected Attributes

std::unique_ptr< v8::Platformv8_platform_

Static Protected Attributes

static constexpr v8::IsolatekNoIsolate = nullptr

Detailed Description

Platform provided by cppgc. Uses V8's DefaultPlatform provided by libplatform internally. Exception: GetForegroundTaskRunner(), see below.

Definition at line 21 of file default-platform.h.

Member Typedef Documentation

◆ IdleTaskSupport

Constructor & Destructor Documentation

◆ DefaultPlatform()

DefaultPlatform ( int  thread_pool_size = 0,
IdleTaskSupport  idle_task_support = IdleTaskSupport::kDisabled,
std::unique_ptr< TracingController tracing_controller = {} 

Definition at line 33 of file default-platform.h.

Member Function Documentation

◆ GetForegroundTaskRunner()

std::shared_ptr<cppgc::TaskRunner> GetForegroundTaskRunner ( )

Foreground task runner that should be used by a Heap.

Reimplemented from Platform.

Definition at line 50 of file default-platform.h.

References Platform::GetForegroundTaskRunner(), DefaultPlatform::kNoIsolate, and DefaultPlatform::v8_platform_.

◆ GetPageAllocator()

cppgc::PageAllocator* GetPageAllocator ( )

Returns the allocator used by cppgc to allocate its heap and various support structures.

Implements Platform.

Definition at line 42 of file default-platform.h.

References Platform::GetPageAllocator(), and DefaultPlatform::v8_platform_.

◆ GetTracingController()

TracingController* GetTracingController ( )

Returns an instance of a TracingController. This must be non-nullptr. The default implementation returns an empty TracingController that consumes trace data without effect.

Reimplemented from Platform.

Definition at line 63 of file default-platform.h.

References Platform::GetTracingController(), and DefaultPlatform::v8_platform_.

◆ InitializeProcess()

static void InitializeProcess ( DefaultPlatform platform)

Use this method instead of 'cppgc::InitializeProcess' when using 'cppgc::DefaultPlatform'. 'cppgc::DefaultPlatform::InitializeProcess' will initialize cppgc and v8 if needed (for non-standalone builds).

platformDefaultPlatform instance used to initialize cppgc/v8.

◆ MonotonicallyIncreasingTime()

double MonotonicallyIncreasingTime ( )

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 Platform.

Definition at line 46 of file default-platform.h.

References Platform::MonotonicallyIncreasingTime(), and DefaultPlatform::v8_platform_.

◆ PostJob()

std::unique_ptr<cppgc::JobHandle> PostJob ( cppgc::TaskPriority  priority,
std::unique_ptr< cppgc::JobTask job_task 

Definition at line 57 of file default-platform.h.

References Platform::PostJob(), and DefaultPlatform::v8_platform_.

Field Documentation

◆ kNoIsolate

constexpr v8::Isolate* kNoIsolate = nullptr

Definition at line 68 of file default-platform.h.

Referenced by DefaultPlatform::GetForegroundTaskRunner().

◆ v8_platform_

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