Commit 07aafb76 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Fix missing cancellation of background compilation

In {WasmEngine::DeleteCompileJobsOnIsolate} (triggered on isolate
teardown), we are deleting the {AsyncCompileJob} with the expectation
that this cancels all background compilation. Since the introduction of
the CompilationState, this is not true any more. The call to
{CompilationState::Abort} is missing.
This CL fixes this by moving the logic from {AsyncCompileJob::Abort} to
{~AsyncCompileJob}, since the former calls the latter anyway.

R=ahaas@chromium.org

Bug: chromium:869420
Change-Id: I4644d161270def0fe3a94d09cde0135ee420a383
Reviewed-on: https://chromium-review.googlesource.com/1172285Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55083}
parent d845d28e
......@@ -2128,9 +2128,8 @@ void AsyncCompileJob::Start() {
}
void AsyncCompileJob::Abort() {
background_task_manager_.CancelAndWait();
if (native_module_) native_module_->compilation_state()->Abort();
CancelPendingForegroundTask();
// Removing this job will trigger the destructor, which will cancel all
// compilation.
isolate_->wasm_engine()->RemoveCompileJob(this);
}
......@@ -2179,6 +2178,8 @@ std::shared_ptr<StreamingDecoder> AsyncCompileJob::CreateStreamingDecoder() {
AsyncCompileJob::~AsyncCompileJob() {
background_task_manager_.CancelAndWait();
if (native_module_) native_module_->compilation_state()->Abort();
CancelPendingForegroundTask();
for (auto d : deferred_handles_) delete d;
}
......
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