OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 #ifndef V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ |
| 6 #define V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ |
| 7 |
| 8 #include "include/v8-platform.h" |
| 9 #include "include/v8.h" |
| 10 #include "src/base/atomic-utils.h" |
| 11 #include "src/base/macros.h" |
| 12 #include "src/base/platform/platform.h" |
| 13 |
| 14 namespace v8_inspector { |
| 15 |
| 16 class Task; |
| 17 class TaskQueue; |
| 18 |
| 19 class TaskRunner : public v8::base::Thread { |
| 20 public: |
| 21 enum State { kRunning, kStopRequested }; |
| 22 |
| 23 explicit TaskRunner(TaskQueue* queue); |
| 24 virtual ~TaskRunner(); |
| 25 |
| 26 void SetContext(v8::Local<v8::Context>); |
| 27 TaskQueue* Queue() const { return queue_; } |
| 28 |
| 29 // Thread implementation. |
| 30 void Run() override; |
| 31 void Stop(); |
| 32 |
| 33 private: |
| 34 TaskQueue* queue_; |
| 35 v8::base::AtomicValue<State> state_; |
| 36 |
| 37 v8::Isolate* isolate_; |
| 38 v8::Global<v8::Context> context_; |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(TaskRunner); |
| 41 }; |
| 42 |
| 43 } // v8_inspector |
| 44 |
| 45 #endif // V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ |
OLD | NEW |