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

Unified Diff: src/cancelable-task.cc

Issue 1409993012: Add {CancelableTaskManager} to handle {Cancelable} concurrent tasks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: First try: incomplete/blocking Created 5 years, 1 month 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
Index: src/cancelable-task.cc
diff --git a/src/cancelable-task.cc b/src/cancelable-task.cc
index 5927c22cdeb20b18081b4cdcdacbc6c3977ee72e..3413d459abe692d659e7ed320e3616e988d6f984 100644
--- a/src/cancelable-task.cc
+++ b/src/cancelable-task.cc
@@ -12,13 +12,15 @@ namespace internal {
Cancelable::Cancelable(Isolate* isolate)
- : isolate_(isolate), is_cancelled_(false) {
+ : isolate_(isolate), status_(kWaiting) {
Hannes Payer (out of office) 2015/11/04 23:19:00 atomic set?
isolate->RegisterCancelableTask(this);
}
Cancelable::~Cancelable() {
- if (!is_cancelled_) {
+ if (CanRun() || IsRunning() || IsCanceled()) {
Hannes Payer (out of office) 2015/11/04 23:19:00 Why would you CanRun here?
+ // Get exclusive access here to avoid a race with the isolate when calling
+ // {CancelForShutdown}.
isolate_->RemoveCancelableTask(this);
}
}

Powered by Google App Engine
This is Rietveld 408576698