Commit 6d776e57 authored by Etienne Pierre-doray's avatar Etienne Pierre-doray Committed by Commit Bot

[Jobs]: Fix task id lifetime.

Delegate kept task id around for longer than the worker is considered
active, thus breaking the task_id < num_worker garantee. The fix is to
adjust the delegate lifetime.

Change-Id: I9aabb1286d507c09bfe9be4fd4f810f232d6e6b9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2437005
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70207}
parent 805f1931
......@@ -127,9 +127,11 @@ class DefaultJobWorker : public Task {
void Run() override {
auto shared_state = state_.lock();
if (!shared_state) return;
DefaultJobState::JobDelegate delegate(shared_state.get());
if (!shared_state->CanRunFirstTask()) return;
do {
// Scope of |delegate| must not outlive DidRunTask() so that associated
// state is freed before the worker becomes inactive.
DefaultJobState::JobDelegate delegate(shared_state.get());
job_task_->Run(&delegate);
} while (shared_state->DidRunTask());
}
......
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