| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 // Should be called from the same thread and only from task. | 46 // Should be called from the same thread and only from task. |
| 47 void RunMessageLoop(bool only_protocol); | 47 void RunMessageLoop(bool only_protocol); |
| 48 void QuitMessageLoop(); | 48 void QuitMessageLoop(); |
| 49 | 49 |
| 50 // TaskRunner takes ownership. | 50 // TaskRunner takes ownership. |
| 51 void Append(Task* task); | 51 void Append(Task* task); |
| 52 | 52 |
| 53 static TaskRunner* FromContext(v8::Local<v8::Context>); | 53 static TaskRunner* FromContext(v8::Local<v8::Context>); |
| 54 | 54 |
| 55 v8::Local<v8::Context> NewContextGroup(); |
| 56 v8::Local<v8::Context> GetContext(int context_group_id); |
| 57 static int GetContextGroupId(v8::Local<v8::Context> context); |
| 58 |
| 55 void Terminate(); | 59 void Terminate(); |
| 56 | 60 |
| 57 void RegisterModule(v8::internal::Vector<uint16_t> name, | 61 void RegisterModule(v8::internal::Vector<uint16_t> name, |
| 58 v8::Local<v8::Module> module); | 62 v8::Local<v8::Module> module); |
| 59 static v8::MaybeLocal<v8::Module> ModuleResolveCallback( | 63 static v8::MaybeLocal<v8::Module> ModuleResolveCallback( |
| 60 v8::Local<v8::Context> context, v8::Local<v8::String> specifier, | 64 v8::Local<v8::Context> context, v8::Local<v8::String> specifier, |
| 61 v8::Local<v8::Module> referrer); | 65 v8::Local<v8::Module> referrer); |
| 62 | 66 |
| 63 private: | 67 private: |
| 64 void InitializeContext(); | 68 void InitializeIsolate(); |
| 65 Task* GetNext(bool only_protocol); | 69 Task* GetNext(bool only_protocol); |
| 66 | 70 |
| 67 v8::ExtensionConfiguration* extensions_; | 71 v8::ExtensionConfiguration* extensions_; |
| 68 bool catch_exceptions_; | 72 bool catch_exceptions_; |
| 69 v8::base::Semaphore* ready_semaphore_; | 73 v8::base::Semaphore* ready_semaphore_; |
| 70 | 74 |
| 71 v8::Isolate* isolate_; | 75 v8::Isolate* isolate_; |
| 72 v8::Global<v8::Context> context_; | 76 intptr_t last_context_group_id_ = 0; |
| 77 std::map<intptr_t, v8::Global<v8::Context>> contexts_; |
| 73 | 78 |
| 74 // deferred_queue_ combined with queue_ (in this order) have all tasks in the | 79 // deferred_queue_ combined with queue_ (in this order) have all tasks in the |
| 75 // correct order. Sometimes we skip non-protocol tasks by moving them from | 80 // correct order. Sometimes we skip non-protocol tasks by moving them from |
| 76 // queue_ to deferred_queue_. | 81 // queue_ to deferred_queue_. |
| 77 v8::internal::LockedQueue<Task*> queue_; | 82 v8::internal::LockedQueue<Task*> queue_; |
| 78 v8::internal::LockedQueue<Task*> deffered_queue_; | 83 v8::internal::LockedQueue<Task*> deffered_queue_; |
| 79 v8::base::Semaphore process_queue_semaphore_; | 84 v8::base::Semaphore process_queue_semaphore_; |
| 80 | 85 |
| 81 std::map<v8::internal::Vector<uint16_t>, v8::Global<v8::Module>, | 86 std::map<v8::internal::Vector<uint16_t>, v8::Global<v8::Module>, |
| 82 VectorCompare> | 87 VectorCompare> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 v8::internal::Vector<const char> expression_utf8_; | 128 v8::internal::Vector<const char> expression_utf8_; |
| 124 v8::internal::Vector<uint16_t> name_; | 129 v8::internal::Vector<uint16_t> name_; |
| 125 int32_t line_offset_ = 0; | 130 int32_t line_offset_ = 0; |
| 126 int32_t column_offset_ = 0; | 131 int32_t column_offset_ = 0; |
| 127 bool is_module_ = false; | 132 bool is_module_ = false; |
| 128 | 133 |
| 129 DISALLOW_COPY_AND_ASSIGN(ExecuteStringTask); | 134 DISALLOW_COPY_AND_ASSIGN(ExecuteStringTask); |
| 130 }; | 135 }; |
| 131 | 136 |
| 132 #endif // V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ | 137 #endif // V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ |
| OLD | NEW |