Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: test/inspector/task-runner.cc

Issue 2428213002: [inspector] finish test runner gracefully.. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/inspector/task-runner.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « test/inspector/task-runner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698