Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / v8 / src / libplatform / worker-thread.cc
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 "worker-thread.h"
6
7 // TODO(jochen): We should have our own version of checks.h.
8 #include "../checks.h"
9 #include "../../include/v8-platform.h"
10 #include "task-queue.h"
11
12 namespace v8 {
13 namespace internal {
14
15 WorkerThread::WorkerThread(TaskQueue* queue)
16     : Thread("V8 WorkerThread"), queue_(queue) {
17   Start();
18 }
19
20
21 WorkerThread::~WorkerThread() {
22   Join();
23 }
24
25
26 void WorkerThread::Run() {
27   while (Task* task = queue_->GetNext()) {
28     task->Run();
29     delete task;
30   }
31 }
32
33 } }  // namespace v8::internal