| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "worker-thread.h" | 5 #include "worker-thread.h" |
| 6 | 6 |
| 7 // TODO(jochen): We should have our own version of checks.h. | |
| 8 #include "../checks.h" | |
| 9 #include "../../include/v8-platform.h" | 7 #include "../../include/v8-platform.h" |
| 10 #include "task-queue.h" | 8 #include "task-queue.h" |
| 11 | 9 |
| 12 namespace v8 { | 10 namespace v8 { |
| 13 namespace internal { | 11 namespace internal { |
| 14 | 12 |
| 15 WorkerThread::WorkerThread(TaskQueue* queue) | 13 WorkerThread::WorkerThread(TaskQueue* queue) |
| 16 : Thread("V8 WorkerThread"), queue_(queue) { | 14 : Thread("V8 WorkerThread"), queue_(queue) { |
| 17 Start(); | 15 Start(); |
| 18 } | 16 } |
| 19 | 17 |
| 20 | 18 |
| 21 WorkerThread::~WorkerThread() { | 19 WorkerThread::~WorkerThread() { |
| 22 Join(); | 20 Join(); |
| 23 } | 21 } |
| 24 | 22 |
| 25 | 23 |
| 26 void WorkerThread::Run() { | 24 void WorkerThread::Run() { |
| 27 while (Task* task = queue_->GetNext()) { | 25 while (Task* task = queue_->GetNext()) { |
| 28 task->Run(); | 26 task->Run(); |
| 29 delete task; | 27 delete task; |
| 30 } | 28 } |
| 31 } | 29 } |
| 32 | 30 |
| 33 } } // namespace v8::internal | 31 } } // namespace v8::internal |
| OLD | NEW |