Index: src/isolate.cc |
diff --git a/src/isolate.cc b/src/isolate.cc |
index 31ab6cf40ef58d0cac2020a959806f9ed261a141..68a6745d56b57cf77d12fa789d2d6392adbba568 100644 |
--- a/src/isolate.cc |
+++ b/src/isolate.cc |
@@ -1797,6 +1797,7 @@ Isolate::Isolate(bool enable_serializer) |
#endif |
use_counter_callback_(NULL), |
basic_block_profiler_(NULL), |
+ cancelable_task_manager_(new CancelableTaskManager()), |
abort_on_uncaught_exception_callback_(NULL) { |
{ |
base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); |
@@ -1920,10 +1921,7 @@ void Isolate::Deinit() { |
delete basic_block_profiler_; |
basic_block_profiler_ = NULL; |
- for (Cancelable* task : cancelable_tasks_) { |
- task->Cancel(); |
- } |
- cancelable_tasks_.clear(); |
+ cancelable_task_manager()->CancelAndWait(); |
heap_.TearDown(); |
logger_->TearDown(); |
@@ -2028,6 +2026,9 @@ Isolate::~Isolate() { |
delete debug_; |
debug_ = NULL; |
+ delete cancelable_task_manager_; |
+ cancelable_task_manager_ = nullptr; |
+ |
#if USE_SIMULATOR |
Simulator::TearDown(simulator_i_cache_, simulator_redirection_); |
simulator_i_cache_ = nullptr; |
@@ -2798,18 +2799,6 @@ void Isolate::CheckDetachedContextsAfterGC() { |
} |
-void Isolate::RegisterCancelableTask(Cancelable* task) { |
- cancelable_tasks_.insert(task); |
-} |
- |
- |
-void Isolate::RemoveCancelableTask(Cancelable* task) { |
- auto removed = cancelable_tasks_.erase(task); |
- USE(removed); |
- DCHECK(removed == 1); |
-} |
- |
- |
bool StackLimitCheck::JsHasOverflowed(uintptr_t gap) const { |
StackGuard* stack_guard = isolate_->stack_guard(); |
#ifdef USE_SIMULATOR |