Commit 94087c80 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[cleanup] Inline one-line CancelAndWait method

Very minor cleanup to reduce code complexity.

R=mstarzinger@chromium.org

Bug: chromium:869420
Change-Id: I53d1776792b3918d489fe002e2cb17b7a3e0ff73
Reviewed-on: https://chromium-review.googlesource.com/1158686Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54849}
parent 2d40e2f4
......@@ -87,7 +87,6 @@ class CompilationState {
void ScheduleUnitForFinishing(std::unique_ptr<WasmCompilationUnit> unit,
WasmCompilationUnit::CompilationMode mode);
void CancelAndWait();
void OnBackgroundTaskStopped();
void RestartBackgroundTasks(size_t max = std::numeric_limits<size_t>::max());
// Only one foreground thread (finisher) is allowed to run at a time.
......@@ -154,8 +153,6 @@ class CompilationState {
// the given {ErrorThrower} can be done at most once.
std::vector<std::function<void(CompilationEvent, ErrorThrower*)>> callbacks_;
// When canceling the background_task_manager_, use {CancelAndWait} on
// the CompilationState in order to cleanly clean up.
CancelableTaskManager background_task_manager_;
CancelableTaskManager foreground_task_manager_;
std::shared_ptr<v8::TaskRunner> foreground_task_runner_;
......@@ -2734,7 +2731,7 @@ CompilationState::CompilationState(internal::Isolate* isolate,
}
CompilationState::~CompilationState() {
CancelAndWait();
background_task_manager_.CancelAndWait();
foreground_task_manager_.CancelAndWait();
NotifyOnEvent(CompilationEvent::kDestroyed, nullptr);
}
......@@ -2823,7 +2820,7 @@ void CompilationState::OnFinishedUnit() {
--outstanding_units_;
if (outstanding_units_ == 0) {
CancelAndWait();
background_task_manager_.CancelAndWait();
baseline_compilation_finished_ = true;
DCHECK(compile_mode_ == CompileMode::kRegular ||
......@@ -2867,10 +2864,6 @@ void CompilationState::ScheduleUnitForFinishing(
}
}
void CompilationState::CancelAndWait() {
background_task_manager_.CancelAndWait();
}
void CompilationState::OnBackgroundTaskStopped() {
base::LockGuard<base::Mutex> guard(&mutex_);
DCHECK_LE(1, num_background_tasks_);
......@@ -2924,7 +2917,7 @@ void CompilationState::Abort() {
base::LockGuard<base::Mutex> guard(&mutex_);
failed_ = true;
}
CancelAndWait();
background_task_manager_.CancelAndWait();
}
void CompilationState::NotifyOnEvent(CompilationEvent event,
......
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