| 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 <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "include/v8-inspector.h" | 10 #include "include/v8-inspector.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 class SetupGlobalTask { | 39 class SetupGlobalTask { |
| 40 public: | 40 public: |
| 41 virtual ~SetupGlobalTask() = default; | 41 virtual ~SetupGlobalTask() = default; |
| 42 virtual void Run(v8::Isolate* isolate, | 42 virtual void Run(v8::Isolate* isolate, |
| 43 v8::Local<v8::ObjectTemplate> global) = 0; | 43 v8::Local<v8::ObjectTemplate> global) = 0; |
| 44 }; | 44 }; |
| 45 using SetupGlobalTasks = std::vector<std::unique_ptr<SetupGlobalTask>>; | 45 using SetupGlobalTasks = std::vector<std::unique_ptr<SetupGlobalTask>>; |
| 46 | 46 |
| 47 TaskRunner(SetupGlobalTasks setup_global_tasks, bool catch_exceptions, | 47 TaskRunner(SetupGlobalTasks setup_global_tasks, bool catch_exceptions, |
| 48 v8::base::Semaphore* ready_semaphore, | 48 v8::base::Semaphore* ready_semaphore); |
| 49 v8::StartupData* startup_data); | |
| 50 virtual ~TaskRunner(); | 49 virtual ~TaskRunner(); |
| 51 | 50 |
| 52 // Thread implementation. | 51 // Thread implementation. |
| 53 void Run() override; | 52 void Run() override; |
| 54 | 53 |
| 55 // Should be called from the same thread and only from task. | 54 // Should be called from the same thread and only from task. |
| 56 void RunMessageLoop(bool only_protocol); | 55 void RunMessageLoop(bool only_protocol); |
| 57 void QuitMessageLoop(); | 56 void QuitMessageLoop(); |
| 58 | 57 |
| 59 // TaskRunner takes ownership. | 58 // TaskRunner takes ownership. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 72 v8::Local<v8::Module> module); | 71 v8::Local<v8::Module> module); |
| 73 static v8::MaybeLocal<v8::Module> ModuleResolveCallback( | 72 static v8::MaybeLocal<v8::Module> ModuleResolveCallback( |
| 74 v8::Local<v8::Context> context, v8::Local<v8::String> specifier, | 73 v8::Local<v8::Context> context, v8::Local<v8::String> specifier, |
| 75 v8::Local<v8::Module> referrer); | 74 v8::Local<v8::Module> referrer); |
| 76 | 75 |
| 77 private: | 76 private: |
| 78 void InitializeIsolate(); | 77 void InitializeIsolate(); |
| 79 Task* GetNext(bool only_protocol); | 78 Task* GetNext(bool only_protocol); |
| 80 | 79 |
| 81 SetupGlobalTasks setup_global_tasks_; | 80 SetupGlobalTasks setup_global_tasks_; |
| 82 v8::StartupData* startup_data_; | |
| 83 bool catch_exceptions_; | 81 bool catch_exceptions_; |
| 84 v8::base::Semaphore* ready_semaphore_; | 82 v8::base::Semaphore* ready_semaphore_; |
| 85 | 83 |
| 86 v8::Isolate* isolate_; | 84 v8::Isolate* isolate_; |
| 87 intptr_t last_context_group_id_ = 0; | 85 intptr_t last_context_group_id_ = 0; |
| 88 std::map<intptr_t, v8::Global<v8::Context>> contexts_; | 86 std::map<intptr_t, v8::Global<v8::Context>> contexts_; |
| 89 | 87 |
| 90 // deferred_queue_ combined with queue_ (in this order) have all tasks in the | 88 // deferred_queue_ combined with queue_ (in this order) have all tasks in the |
| 91 // correct order. Sometimes we skip non-protocol tasks by moving them from | 89 // correct order. Sometimes we skip non-protocol tasks by moving them from |
| 92 // queue_ to deferred_queue_. | 90 // queue_ to deferred_queue_. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 v8::internal::Vector<const char> expression_utf8_; | 137 v8::internal::Vector<const char> expression_utf8_; |
| 140 v8::internal::Vector<uint16_t> name_; | 138 v8::internal::Vector<uint16_t> name_; |
| 141 int32_t line_offset_ = 0; | 139 int32_t line_offset_ = 0; |
| 142 int32_t column_offset_ = 0; | 140 int32_t column_offset_ = 0; |
| 143 bool is_module_ = false; | 141 bool is_module_ = false; |
| 144 | 142 |
| 145 DISALLOW_COPY_AND_ASSIGN(ExecuteStringTask); | 143 DISALLOW_COPY_AND_ASSIGN(ExecuteStringTask); |
| 146 }; | 144 }; |
| 147 | 145 |
| 148 #endif // V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ | 146 #endif // V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ |
| OLD | NEW |