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

Unified Diff: src/isolate.cc

Issue 1409993012: Add {CancelableTaskManager} to handle {Cancelable} concurrent tasks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments 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
« no previous file with comments | « src/isolate.h ('k') | test/unittests/cancelable-tasks-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/isolate.h ('k') | test/unittests/cancelable-tasks-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698