V8 Project
worker-thread.cc
Go to the documentation of this file.
1
// Copyright 2013 the V8 project authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#include "
src/libplatform/worker-thread.h
"
6
7
#include "
include/v8-platform.h
"
8
#include "
src/libplatform/task-queue.h
"
9
10
namespace
v8
{
11
namespace
platform {
12
13
WorkerThread::WorkerThread
(
TaskQueue
* queue)
14
: Thread(
Options
(
"V8 WorkerThread"
)), queue_(queue) {
15
Start
();
16
}
17
18
19
WorkerThread::~WorkerThread
() {
20
Join
();
21
}
22
23
24
void
WorkerThread::Run
() {
25
while
(
Task
* task =
queue_
->
GetNext
()) {
26
task->Run();
27
delete
task;
28
}
29
}
30
31
} }
// namespace v8::platform
v8::Task
A Task represents a unit of work.
Definition:
v8-platform.h:15
v8::base::Thread::Options
Definition:
platform.h:418
v8::base::Thread::Join
void Join()
Definition:
platform-posix.cc:542
v8::base::Thread::Start
void Start()
Definition:
platform-posix.cc:517
v8::platform::TaskQueue
Definition:
task-queue.h:20
v8::platform::TaskQueue::GetNext
Task * GetNext()
Definition:
task-queue.cc:30
v8::platform::WorkerThread::~WorkerThread
virtual ~WorkerThread()
Definition:
worker-thread.cc:19
v8::platform::WorkerThread::queue_
TaskQueue * queue_
Definition:
worker-thread.h:30
v8::platform::WorkerThread::WorkerThread
WorkerThread(TaskQueue *queue)
Definition:
worker-thread.cc:13
v8::platform::WorkerThread::Run
virtual void Run() OVERRIDE
Definition:
worker-thread.cc:24
v8
Debugger support for the V8 JavaScript engine.
Definition:
accessors.cc:20
task-queue.h
v8-platform.h
worker-thread.h
mnt
V8SourceCode
src
libplatform
worker-thread.cc
Generated on Tue Jul 1 2025 02:36:41 for V8 Project by
1.9.1