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

#include <d8.h>

Inheritance diagram for v8::Worker:
Collaboration diagram for v8::Worker:

Classes

class  WorkerThread
 

Public Member Functions

 Worker (Isolate *parent_isolate, const char *script, bool flush_denormals)
 
 ~Worker ()
 
void PostMessage (std::unique_ptr< SerializationData > data)
 
std::unique_ptr< SerializationDataGetMessage (Isolate *requester)
 
std::unique_ptr< SerializationDataTryGetMessage ()
 
void Terminate ()
 
void TerminateAndWaitForThread (const i::ParkedScope &parked)
 
void EnterTerminatedState ()
 
bool IsTerminated () const
 

Static Public Member Functions

static bool StartWorkerThread (Isolate *requester, std::shared_ptr< Worker > worker, base::Thread::Priority priority)
 
static WorkerGetCurrentWorker ()
 

Static Public Attributes

static constexpr i::ExternalPointerTag kManagedTag = i::kD8WorkerTag
 

Private Types

enum class  State {
  kReady , kPrepareRunning , kRunning , kTerminating ,
  kTerminated
}
 

Private Member Functions

bool is_running () const
 
void ProcessMessage (std::unique_ptr< SerializationData > data)
 
void ProcessMessages ()
 
void ExecuteInThread ()
 

Static Private Member Functions

static void PostMessageOut (const v8::FunctionCallbackInfo< v8::Value > &info)
 
static void ImportScripts (const v8::FunctionCallbackInfo< v8::Value > &info)
 
static void Close (const v8::FunctionCallbackInfo< v8::Value > &info)
 
static void SetCurrentWorker (Worker *worker)
 

Private Attributes

i::ParkingSemaphore out_semaphore_ {0}
 
SerializationDataQueue out_queue_
 
base::Threadthread_ = nullptr
 
char * script_
 
bool flush_denormals_
 
std::atomic< Statestate_
 
bool is_joined_ = false
 
i::ParkingSemaphore started_semaphore_ {0}
 
std::shared_ptr< TaskRunnertask_runner_
 
i::CancelableTaskManagertask_manager_
 
base::Mutex worker_mutex_
 
Isolateisolate_ = nullptr
 
Isolateparent_isolate_
 
Global< Contextcontext_
 

Friends

class ProcessMessageTask
 
class TerminateTask
 

Detailed Description

Definition at line 187 of file d8.h.

Member Enumeration Documentation

◆ State

enum class v8::Worker::State
strongprivate
Enumerator
kReady 
kPrepareRunning 
kRunning 
kTerminating 
kTerminated 

Definition at line 234 of file d8.h.

Constructor & Destructor Documentation

◆ Worker()

v8::Worker::Worker ( Isolate * parent_isolate,
const char * script,
bool flush_denormals )
explicit

Definition at line 5184 of file d8.cc.

◆ ~Worker()

v8::Worker::~Worker ( )

Definition at line 5192 of file d8.cc.

Member Function Documentation

◆ Close()

void v8::Worker::Close ( const v8::FunctionCallbackInfo< v8::Value > & info)
staticprivate

Definition at line 5567 of file d8.cc.

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

◆ EnterTerminatedState()

void v8::Worker::EnterTerminatedState ( )

Definition at line 5316 of file d8.cc.

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

◆ ExecuteInThread()

void v8::Worker::ExecuteInThread ( )
private

Definition at line 5391 of file d8.cc.

Here is the call graph for this function:

◆ GetCurrentWorker()

Worker * v8::Worker::GetCurrentWorker ( )
static

Definition at line 5389 of file d8.cc.

Here is the caller graph for this function:

◆ GetMessage()

std::unique_ptr< SerializationData > v8::Worker::GetMessage ( Isolate * requester)

Definition at line 5271 of file d8.cc.

Here is the call graph for this function:

◆ ImportScripts()

void v8::Worker::ImportScripts ( const v8::FunctionCallbackInfo< v8::Value > & info)
staticprivate

Definition at line 5563 of file d8.cc.

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

◆ is_running()

bool v8::Worker::is_running ( ) const
private

Definition at line 5201 of file d8.cc.

Here is the caller graph for this function:

◆ IsTerminated()

bool v8::Worker::IsTerminated ( ) const
inline

Definition at line 225 of file d8.h.

◆ PostMessage()

void v8::Worker::PostMessage ( std::unique_ptr< SerializationData > data)

Definition at line 5247 of file d8.cc.

Here is the call graph for this function:

◆ PostMessageOut()

void v8::Worker::PostMessageOut ( const v8::FunctionCallbackInfo< v8::Value > & info)
staticprivate

Definition at line 5536 of file d8.cc.

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

◆ ProcessMessage()

void v8::Worker::ProcessMessage ( std::unique_ptr< SerializationData > data)
private

Definition at line 5324 of file d8.cc.

Here is the call graph for this function:

◆ ProcessMessages()

void v8::Worker::ProcessMessages ( )
private

Definition at line 5364 of file d8.cc.

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

◆ SetCurrentWorker()

void v8::Worker::SetCurrentWorker ( Worker * worker)
staticprivate

Definition at line 5383 of file d8.cc.

Here is the caller graph for this function:

◆ StartWorkerThread()

bool v8::Worker::StartWorkerThread ( Isolate * requester,
std::shared_ptr< Worker > worker,
base::Thread::Priority priority )
static

Definition at line 5203 of file d8.cc.

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

◆ Terminate()

void v8::Worker::Terminate ( )

Definition at line 5303 of file d8.cc.

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

◆ TerminateAndWaitForThread()

void v8::Worker::TerminateAndWaitForThread ( const i::ParkedScope & parked)

Definition at line 5291 of file d8.cc.

Here is the call graph for this function:

◆ TryGetMessage()

std::unique_ptr< SerializationData > v8::Worker::TryGetMessage ( )

Definition at line 5283 of file d8.cc.

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ ProcessMessageTask

friend class ProcessMessageTask
friend

Definition at line 231 of file d8.h.

◆ TerminateTask

friend class TerminateTask
friend

Definition at line 232 of file d8.h.

Member Data Documentation

◆ context_

Global<Context> v8::Worker::context_
private

Definition at line 291 of file d8.h.

◆ flush_denormals_

bool v8::Worker::flush_denormals_
private

Definition at line 271 of file d8.h.

◆ is_joined_

bool v8::Worker::is_joined_ = false
private

Definition at line 273 of file d8.h.

◆ isolate_

Isolate* v8::Worker::isolate_ = nullptr
private

Definition at line 287 of file d8.h.

◆ kManagedTag

i::ExternalPointerTag v8::Worker::kManagedTag = i::kD8WorkerTag
staticconstexpr

Definition at line 189 of file d8.h.

◆ out_queue_

SerializationDataQueue v8::Worker::out_queue_
private

Definition at line 267 of file d8.h.

◆ out_semaphore_

i::ParkingSemaphore v8::Worker::out_semaphore_ {0}
private

Definition at line 266 of file d8.h.

◆ parent_isolate_

Isolate* v8::Worker::parent_isolate_
private

Definition at line 288 of file d8.h.

◆ script_

char* v8::Worker::script_
private

Definition at line 270 of file d8.h.

◆ started_semaphore_

i::ParkingSemaphore v8::Worker::started_semaphore_ {0}
private

Definition at line 275 of file d8.h.

◆ state_

std::atomic<State> v8::Worker::state_
private

Definition at line 272 of file d8.h.

◆ task_manager_

i::CancelableTaskManager* v8::Worker::task_manager_
private

Definition at line 279 of file d8.h.

◆ task_runner_

std::shared_ptr<TaskRunner> v8::Worker::task_runner_
private

Definition at line 278 of file d8.h.

◆ thread_

base::Thread* v8::Worker::thread_ = nullptr
private

Definition at line 269 of file d8.h.

◆ worker_mutex_

base::Mutex v8::Worker::worker_mutex_
private

Definition at line 283 of file d8.h.


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