2015-07-20 15:03:51 +00:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
#include "src/cancelable-task.h"
|
|
|
|
|
|
|
|
#include "src/base/platform/platform.h"
|
2015-08-20 07:44:00 +00:00
|
|
|
#include "src/isolate.h"
|
2015-07-20 15:03:51 +00:00
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
|
2015-07-30 14:09:01 +00:00
|
|
|
Cancelable::Cancelable(Isolate* isolate)
|
2015-07-20 15:03:51 +00:00
|
|
|
: isolate_(isolate), is_cancelled_(false) {
|
|
|
|
isolate->RegisterCancelableTask(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-07-30 14:09:01 +00:00
|
|
|
Cancelable::~Cancelable() {
|
2015-07-20 15:03:51 +00:00
|
|
|
if (!is_cancelled_) {
|
|
|
|
isolate_->RemoveCancelableTask(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|