[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/1158686
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54849}
This commit is contained in:
Clemens Hammacher 2018-08-01 16:27:54 +02:00 committed by Commit Bot
parent 2d40e2f445
commit 94087c8038

View File

@ -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,