Commit cc43e598 authored by Xi Han's avatar Xi Han Committed by Commit Bot

Fix browsertests failures in TaskTracker when starting TaskScheduler early

Add an additional check before calling
GetPreemptedSequenceToScheduleLockRequired().

Bug: 892633
Change-Id: I7ee9bcf1e05a96dbabb9378fc6ea99118e0810fe
Reviewed-on: https://chromium-review.googlesource.com/c/1263894Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Commit-Queue: Xi Han <hanxi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597220}
parent ecfb0648
...@@ -912,11 +912,16 @@ scoped_refptr<Sequence> TaskTracker::ManageSequencesAfterRunningTask( ...@@ -912,11 +912,16 @@ scoped_refptr<Sequence> TaskTracker::ManageSequencesAfterRunningTask(
--preemption_state_[priority_index].current_scheduled_sequences; --preemption_state_[priority_index].current_scheduled_sequences;
const bool can_schedule_sequence =
preemption_state_[priority_index].current_scheduled_sequences <
preemption_state_[priority_index].max_scheduled_sequences;
if (just_ran_sequence) { if (just_ran_sequence) {
if (preemption_state_[priority_index].preempted_sequences.empty() || if (can_schedule_sequence &&
preemption_state_[priority_index] (preemption_state_[priority_index].preempted_sequences.empty() ||
.preempted_sequences.top() preemption_state_[priority_index]
.next_task_sequenced_time > next_task_sequenced_time) { .preempted_sequences.top()
.next_task_sequenced_time > next_task_sequenced_time)) {
++preemption_state_[priority_index].current_scheduled_sequences; ++preemption_state_[priority_index].current_scheduled_sequences;
return just_ran_sequence; return just_ran_sequence;
} }
...@@ -925,7 +930,8 @@ scoped_refptr<Sequence> TaskTracker::ManageSequencesAfterRunningTask( ...@@ -925,7 +930,8 @@ scoped_refptr<Sequence> TaskTracker::ManageSequencesAfterRunningTask(
std::move(just_ran_sequence), next_task_sequenced_time, observer); std::move(just_ran_sequence), next_task_sequenced_time, observer);
} }
if (!preemption_state_[priority_index].preempted_sequences.empty()) { if (can_schedule_sequence &&
!preemption_state_[priority_index].preempted_sequences.empty()) {
sequence_to_schedule = sequence_to_schedule =
GetPreemptedSequenceToScheduleLockRequired(task_priority); GetPreemptedSequenceToScheduleLockRequired(task_priority);
} }
......
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