| Index: test/inspector/task-runner.cc
|
| diff --git a/test/inspector/task-runner.cc b/test/inspector/task-runner.cc
|
| index e4386e58ec4cfcafb88cbeb7682e85a7169eec03..95700d5cb39eed51ba1438e4129f95ab02e4c3c1 100644
|
| --- a/test/inspector/task-runner.cc
|
| +++ b/test/inspector/task-runner.cc
|
| @@ -63,8 +63,9 @@ void TaskRunner::Run() {
|
|
|
| void TaskRunner::RunMessageLoop(bool only_protocol) {
|
| int loop_number = ++nested_loop_count_;
|
| - while (nested_loop_count_ == loop_number) {
|
| + while (nested_loop_count_ == loop_number && !is_terminated_.Value()) {
|
| TaskRunner::Task* task = GetNext(only_protocol);
|
| + if (!task) return;
|
| v8::Isolate::Scope isolate_scope(isolate_);
|
| if (catch_exceptions_) {
|
| v8::TryCatch try_catch(isolate_);
|
| @@ -93,8 +94,14 @@ void TaskRunner::Append(Task* task) {
|
| process_queue_semaphore_.Signal();
|
| }
|
|
|
| +void TaskRunner::Terminate() {
|
| + is_terminated_.Increment(1);
|
| + process_queue_semaphore_.Signal();
|
| +}
|
| +
|
| TaskRunner::Task* TaskRunner::GetNext(bool only_protocol) {
|
| for (;;) {
|
| + if (is_terminated_.Value()) return nullptr;
|
| if (only_protocol) {
|
| Task* task = nullptr;
|
| if (queue_.Dequeue(&task)) {
|
| @@ -108,7 +115,6 @@ TaskRunner::Task* TaskRunner::GetNext(bool only_protocol) {
|
| }
|
| process_queue_semaphore_.Wait();
|
| }
|
| - UNREACHABLE();
|
| return nullptr;
|
| }
|
|
|
|
|