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