OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 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 #ifndef V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ | 5 #ifndef V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ |
6 #define V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ | 6 #define V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ |
7 | 7 |
8 #include "include/v8-inspector.h" | 8 #include "include/v8-inspector.h" |
9 #include "include/v8-platform.h" | 9 #include "include/v8-platform.h" |
10 #include "include/v8.h" | 10 #include "include/v8.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 v8::internal::LockedQueue<Task*> deffered_queue_; | 60 v8::internal::LockedQueue<Task*> deffered_queue_; |
61 v8::base::Semaphore process_queue_semaphore_; | 61 v8::base::Semaphore process_queue_semaphore_; |
62 | 62 |
63 int nested_loop_count_; | 63 int nested_loop_count_; |
64 | 64 |
65 v8::base::AtomicNumber<int> is_terminated_; | 65 v8::base::AtomicNumber<int> is_terminated_; |
66 | 66 |
67 DISALLOW_COPY_AND_ASSIGN(TaskRunner); | 67 DISALLOW_COPY_AND_ASSIGN(TaskRunner); |
68 }; | 68 }; |
69 | 69 |
70 class ExecuteStringTask : public TaskRunner::Task { | 70 class AsyncTask : public TaskRunner::Task { |
| 71 public: |
| 72 AsyncTask(const char* task_name, v8_inspector::V8Inspector* inspector); |
| 73 virtual ~AsyncTask() = default; |
| 74 |
| 75 void Run(v8::Isolate* isolate, |
| 76 const v8::Global<v8::Context>& context) override; |
| 77 virtual void AsyncRun(v8::Isolate* isolate, |
| 78 const v8::Global<v8::Context>& context) = 0; |
| 79 |
| 80 private: |
| 81 v8_inspector::V8Inspector* inspector_; |
| 82 }; |
| 83 |
| 84 class ExecuteStringTask : public AsyncTask { |
71 public: | 85 public: |
72 ExecuteStringTask(const v8::internal::Vector<uint16_t>& expression, | 86 ExecuteStringTask(const v8::internal::Vector<uint16_t>& expression, |
73 v8::Local<v8::String> name, | 87 v8::Local<v8::String> name, |
74 v8::Local<v8::Integer> line_offset, | 88 v8::Local<v8::Integer> line_offset, |
75 v8::Local<v8::Integer> column_offset); | 89 v8::Local<v8::Integer> column_offset, const char* task_name, |
| 90 v8_inspector::V8Inspector* inspector); |
76 explicit ExecuteStringTask( | 91 explicit ExecuteStringTask( |
77 const v8::internal::Vector<const char>& expression); | 92 const v8::internal::Vector<const char>& expression); |
78 bool is_inspector_task() override { return false; } | 93 bool is_inspector_task() override { return false; } |
79 | 94 |
80 void Run(v8::Isolate* isolate, | 95 void AsyncRun(v8::Isolate* isolate, |
81 const v8::Global<v8::Context>& context) override; | 96 const v8::Global<v8::Context>& context) override; |
82 | 97 |
83 private: | 98 private: |
84 v8::internal::Vector<uint16_t> expression_; | 99 v8::internal::Vector<uint16_t> expression_; |
85 v8::internal::Vector<const char> expression_utf8_; | 100 v8::internal::Vector<const char> expression_utf8_; |
86 v8::internal::Vector<uint16_t> name_; | 101 v8::internal::Vector<uint16_t> name_; |
87 int32_t line_offset_; | 102 int32_t line_offset_; |
88 int32_t column_offset_; | 103 int32_t column_offset_; |
89 | 104 |
90 DISALLOW_COPY_AND_ASSIGN(ExecuteStringTask); | 105 DISALLOW_COPY_AND_ASSIGN(ExecuteStringTask); |
91 }; | 106 }; |
92 | 107 |
93 #endif // V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ | 108 #endif // V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ |
OLD | NEW |