#include "base/task/sequence_manager/task_queue_selector.h"
#include <bit>
#include <optional>
#include <utility>
#include "base/check_op.h"
#include "base/task/sequence_manager/associated_thread_id.h"
#include "base/task/sequence_manager/task_queue_impl.h"
#include "base/task/sequence_manager/work_queue.h"
#include "base/task/task_features.h"
#include "base/threading/thread_checker.h"
#include "base/trace_event/base_tracing.h"
namespace base {
namespace sequence_manager {
namespace internal {
std::atomic_int TaskQueueSelector::g_max_delayed_starvation_tasks = …;
TaskQueueSelector::TaskQueueSelector(
scoped_refptr<const AssociatedThreadId> associated_thread,
const SequenceManager::Settings& settings)
: … { … }
TaskQueueSelector::~TaskQueueSelector() = default;
void TaskQueueSelector::InitializeFeatures() { … }
void TaskQueueSelector::AddQueue(internal::TaskQueueImpl* queue,
TaskQueue::QueuePriority priority) { … }
void TaskQueueSelector::RemoveQueue(internal::TaskQueueImpl* queue) { … }
void TaskQueueSelector::EnableQueue(internal::TaskQueueImpl* queue) { … }
void TaskQueueSelector::DisableQueue(internal::TaskQueueImpl* queue) { … }
void TaskQueueSelector::SetQueuePriority(internal::TaskQueueImpl* queue,
TaskQueue::QueuePriority priority) { … }
void TaskQueueSelector::AddQueueImpl(internal::TaskQueueImpl* queue,
TaskQueue::QueuePriority priority) { … }
void TaskQueueSelector::ChangeSetIndex(internal::TaskQueueImpl* queue,
TaskQueue::QueuePriority priority) { … }
void TaskQueueSelector::RemoveQueueImpl(internal::TaskQueueImpl* queue) { … }
void TaskQueueSelector::WorkQueueSetBecameEmpty(size_t set_index) { … }
void TaskQueueSelector::WorkQueueSetBecameNonEmpty(size_t set_index) { … }
void TaskQueueSelector::CollectSkippedOverLowerPriorityTasks(
const internal::WorkQueue* selected_work_queue,
std::vector<const Task*>* result) const { … }
#if DCHECK_IS_ON() || !defined(NDEBUG)
bool TaskQueueSelector::CheckContainsQueueForTest(
const internal::TaskQueueImpl* queue) const { … }
#endif
WorkQueue* TaskQueueSelector::SelectWorkQueueToService(
SelectTaskOption option) { … }
Value::Dict TaskQueueSelector::AsValue() const { … }
void TaskQueueSelector::SetTaskQueueSelectorObserver(Observer* observer) { … }
std::optional<TaskQueue::QueuePriority>
TaskQueueSelector::GetHighestPendingPriority(SelectTaskOption option) const { … }
void TaskQueueSelector::SetImmediateStarvationCountForTest(
int immediate_starvation_count) { … }
bool TaskQueueSelector::HasTasksWithPriority(
TaskQueue::QueuePriority priority) const { … }
TaskQueueSelector::ActivePriorityTracker::ActivePriorityTracker() = default;
void TaskQueueSelector::ActivePriorityTracker::SetActive(
TaskQueue::QueuePriority priority,
bool is_active) { … }
TaskQueue::QueuePriority
TaskQueueSelector::ActivePriorityTracker::HighestActivePriority() const { … }
}
}
}