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

Unified Diff: src/cancelable-task.h

Issue 1246603002: Don't run the second pass of the pending phantom callbacks if the heap has been torn down. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: update Created 5 years, 5 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 | « BUILD.gn ('k') | src/cancelable-task.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cancelable-task.h
diff --git a/src/cancelable-task.h b/src/cancelable-task.h
new file mode 100644
index 0000000000000000000000000000000000000000..1a15e248efe8bf555b4f4e6db6e0ca73e7b1a76a
--- /dev/null
+++ b/src/cancelable-task.h
@@ -0,0 +1,43 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_CANCELABLE_TASK_H_
+#define V8_CANCELABLE_TASK_H_
+
+#include "include/v8-platform.h"
+#include "src/base/macros.h"
+
+namespace v8 {
+namespace internal {
+
+class Isolate;
+
+class CancelableTask : public Task {
+ public:
+ explicit CancelableTask(Isolate* isolate);
+ ~CancelableTask() override;
+
+ void Cancel() { is_cancelled_ = true; }
+
+ void Run() final {
+ if (!is_cancelled_) {
+ RunInternal();
+ }
+ }
+
+ virtual void RunInternal() = 0;
+
+ protected:
+ Isolate* isolate_;
+
+ private:
+ bool is_cancelled_;
+
+ DISALLOW_COPY_AND_ASSIGN(CancelableTask);
+};
+
+} // namespace internal
+} // namespace v8
+
+#endif // V8_CANCELABLE_TASK_H_
« no previous file with comments | « BUILD.gn ('k') | src/cancelable-task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698