Commit f0c3a252 authored by ulan's avatar ulan Committed by Commit bot

Revert of [heap] Cancel tasks before tearing down the heap. (patchset #2...

Revert of [heap] Cancel tasks before tearing down the heap. (patchset #2 id:20001 of https://codereview.chromium.org/2413203004/ )

Reason for revert:
Timeout on gc stress bot.

Original issue's description:
> [heap] Cancel tasks before tearing down the heap.
>
> BUG=chromium:654343
>
> Committed: https://crrev.com/9365463d6f1fc11b2369fff63ca0ac825c61eae4
> Cr-Commit-Position: refs/heads/master@{#40272}

TBR=mlippautz@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:654343

Review-Url: https://codereview.chromium.org/2414073002
Cr-Commit-Position: refs/heads/master@{#40279}
parent 86fcace5
......@@ -26,20 +26,14 @@ Cancelable::~Cancelable() {
}
}
CancelableTaskManager::CancelableTaskManager()
: task_id_counter_(0), canceled_(false) {}
CancelableTaskManager::CancelableTaskManager() : task_id_counter_(0) {}
uint32_t CancelableTaskManager::Register(Cancelable* task) {
base::LockGuard<base::Mutex> guard(&mutex_);
uint32_t id = ++task_id_counter_;
// The loop below is just used when task_id_counter_ overflows.
while (cancelable_tasks_.count(id) > 0) ++id;
if (canceled_) {
bool successfully_canceled_task = task->Cancel();
CHECK(successfully_canceled_task);
} else {
cancelable_tasks_[id] = task;
}
cancelable_tasks_[id] = task;
return id;
}
......@@ -75,7 +69,6 @@ void CancelableTaskManager::CancelAndWait() {
// of canceling we wait for the background tasks that have already been
// started.
base::LockGuard<base::Mutex> guard(&mutex_);
canceled_ = true;
// Cancelable tasks could be running or could potentially register new
// tasks, requiring a loop here.
......
......@@ -40,8 +40,7 @@ class CancelableTaskManager {
bool TryAbort(uint32_t id);
// Cancels all remaining registered tasks and waits for tasks that are
// already running. After this function is called all subsequent new tasks
// will be cancelled on creation.
// already running.
void CancelAndWait();
private:
......@@ -60,8 +59,6 @@ class CancelableTaskManager {
base::ConditionVariable cancelable_tasks_barrier_;
base::Mutex mutex_;
bool canceled_;
friend class Cancelable;
DISALLOW_COPY_AND_ASSIGN(CancelableTaskManager);
......
......@@ -2182,8 +2182,6 @@ void Isolate::ClearSerializerData() {
void Isolate::Deinit() {
TRACE_ISOLATE(deinit);
cancelable_task_manager()->CancelAndWait();
debug()->Unload();
FreeThreadResources();
......@@ -2234,6 +2232,8 @@ void Isolate::Deinit() {
delete interpreter_;
interpreter_ = NULL;
cancelable_task_manager()->CancelAndWait();
delete cpu_profiler_;
cpu_profiler_ = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment