| 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 23 matching lines...) Expand all Loading... |
| 34 v8::Isolate* isolate() const { return data_->isolate(); } | 34 v8::Isolate* isolate() const { return data_->isolate(); } |
| 35 IsolateData* data() const { return data_; } | 35 IsolateData* data() const { return data_; } |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 IsolateData* data_ = nullptr; | 38 IsolateData* data_ = nullptr; |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 TaskRunner(IsolateData::SetupGlobalTasks setup_global_tasks, | 41 TaskRunner(IsolateData::SetupGlobalTasks setup_global_tasks, |
| 42 bool catch_exceptions, v8::base::Semaphore* ready_semaphore, | 42 bool catch_exceptions, v8::base::Semaphore* ready_semaphore, |
| 43 v8::StartupData* startup_data, | 43 v8::StartupData* startup_data, |
| 44 InspectorClientImpl::FrontendChannel* channel); | 44 IsolateData::FrontendChannel* channel); |
| 45 virtual ~TaskRunner(); | 45 virtual ~TaskRunner(); |
| 46 IsolateData* data() const { return data_.get(); } | 46 IsolateData* data() const { return data_.get(); } |
| 47 | 47 |
| 48 // Thread implementation. | 48 // Thread implementation. |
| 49 void Run() override; | 49 void Run() override; |
| 50 | 50 |
| 51 // Should be called from the same thread and only from task. | 51 // Should be called from the same thread and only from task. |
| 52 void RunMessageLoop(bool only_protocol); | 52 void RunMessageLoop(bool only_protocol); |
| 53 void QuitMessageLoop(); | 53 void QuitMessageLoop(); |
| 54 | 54 |
| 55 // TaskRunner takes ownership. | 55 // TaskRunner takes ownership. |
| 56 void Append(Task* task); | 56 void Append(Task* task); |
| 57 | 57 |
| 58 void Terminate(); | 58 void Terminate(); |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 Task* GetNext(bool only_protocol); | 61 Task* GetNext(bool only_protocol); |
| 62 v8::Isolate* isolate() const { return data_->isolate(); } | 62 v8::Isolate* isolate() const { return data_->isolate(); } |
| 63 | 63 |
| 64 IsolateData::SetupGlobalTasks setup_global_tasks_; | 64 IsolateData::SetupGlobalTasks setup_global_tasks_; |
| 65 v8::StartupData* startup_data_; | 65 v8::StartupData* startup_data_; |
| 66 InspectorClientImpl::FrontendChannel* channel_; | 66 IsolateData::FrontendChannel* channel_; |
| 67 bool catch_exceptions_; | 67 bool catch_exceptions_; |
| 68 v8::base::Semaphore* ready_semaphore_; | 68 v8::base::Semaphore* ready_semaphore_; |
| 69 std::unique_ptr<IsolateData> data_; | 69 std::unique_ptr<IsolateData> data_; |
| 70 | 70 |
| 71 // deferred_queue_ combined with queue_ (in this order) have all tasks in the | 71 // deferred_queue_ combined with queue_ (in this order) have all tasks in the |
| 72 // correct order. Sometimes we skip non-protocol tasks by moving them from | 72 // correct order. Sometimes we skip non-protocol tasks by moving them from |
| 73 // queue_ to deferred_queue_. | 73 // queue_ to deferred_queue_. |
| 74 v8::internal::LockedQueue<Task*> queue_; | 74 v8::internal::LockedQueue<Task*> queue_; |
| 75 v8::internal::LockedQueue<Task*> deffered_queue_; | 75 v8::internal::LockedQueue<Task*> deffered_queue_; |
| 76 v8::base::Semaphore process_queue_semaphore_; | 76 v8::base::Semaphore process_queue_semaphore_; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 v8::internal::Vector<uint16_t> name_; | 115 v8::internal::Vector<uint16_t> name_; |
| 116 int32_t line_offset_ = 0; | 116 int32_t line_offset_ = 0; |
| 117 int32_t column_offset_ = 0; | 117 int32_t column_offset_ = 0; |
| 118 bool is_module_ = false; | 118 bool is_module_ = false; |
| 119 int context_group_id_; | 119 int context_group_id_; |
| 120 | 120 |
| 121 DISALLOW_COPY_AND_ASSIGN(ExecuteStringTask); | 121 DISALLOW_COPY_AND_ASSIGN(ExecuteStringTask); |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 #endif // V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ | 124 #endif // V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ |
| OLD | NEW |