aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/cancelable-task.h
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2017-02-14 11:27:26 +0100
committerMichaël Zasso <targos@protonmail.com>2017-02-22 15:55:42 +0100
commit7a77daf24344db7942e34c962b0f1ee729ab7af5 (patch)
treee7cbe7bf4e2f4b802a8f5bc18336c546cd6a0d7f /deps/v8/src/cancelable-task.h
parent5f08871ee93ea739148cc49e0f7679e33c70295a (diff)
downloadandroid-node-v8-7a77daf24344db7942e34c962b0f1ee729ab7af5.tar.gz
android-node-v8-7a77daf24344db7942e34c962b0f1ee729ab7af5.tar.bz2
android-node-v8-7a77daf24344db7942e34c962b0f1ee729ab7af5.zip
deps: update V8 to 5.6.326.55
PR-URL: https://github.com/nodejs/node/pull/10992 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'deps/v8/src/cancelable-task.h')
-rw-r--r--deps/v8/src/cancelable-task.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/deps/v8/src/cancelable-task.h b/deps/v8/src/cancelable-task.h
index b1d62aad4b..65f98e7662 100644
--- a/deps/v8/src/cancelable-task.h
+++ b/deps/v8/src/cancelable-task.h
@@ -11,6 +11,7 @@
#include "src/base/atomic-utils.h"
#include "src/base/macros.h"
#include "src/base/platform/condition-variable.h"
+#include "src/globals.h"
namespace v8 {
namespace internal {
@@ -21,26 +22,27 @@ class Isolate;
// Keeps track of cancelable tasks. It is possible to register and remove tasks
// from any fore- and background task/thread.
-class CancelableTaskManager {
+class V8_EXPORT_PRIVATE CancelableTaskManager {
public:
CancelableTaskManager();
// Registers a new cancelable {task}. Returns the unique {id} of the task that
// can be used to try to abort a task by calling {Abort}.
+ // Must not be called after CancelAndWait.
uint32_t Register(Cancelable* task);
// Try to abort running a task identified by {id}. The possible outcomes are:
- // (1) The task is already finished running and thus has been removed from
- // the manager.
+ // (1) The task is already finished running or was canceled before and
+ // thus has been removed from the manager.
// (2) The task is currently running and cannot be canceled anymore.
// (3) The task is not yet running (or finished) so it is canceled and
// removed.
//
- // Returns {false} for (1) and (2), and {true} for (3).
- bool TryAbort(uint32_t id);
+ enum TryAbortResult { kTaskRemoved, kTaskRunning, kTaskAborted };
+ TryAbortResult TryAbort(uint32_t id);
// Cancels all remaining registered tasks and waits for tasks that are
- // already running.
+ // already running. This disallows subsequent Register calls.
void CancelAndWait();
private:
@@ -59,13 +61,14 @@ class CancelableTaskManager {
base::ConditionVariable cancelable_tasks_barrier_;
base::Mutex mutex_;
+ bool canceled_;
+
friend class Cancelable;
DISALLOW_COPY_AND_ASSIGN(CancelableTaskManager);
};
-
-class Cancelable {
+class V8_EXPORT_PRIVATE Cancelable {
public:
explicit Cancelable(CancelableTaskManager* parent);
virtual ~Cancelable();