#include "base/task/thread_pool/job_task_source.h"
#include <bit>
#include <type_traits>
#include <utility>
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h"
#include "base/notreached.h"
#include "base/task/common/checked_lock.h"
#include "base/task/task_features.h"
#include "base/task/thread_pool/pooled_task_runner_delegate.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "base/time/time_override.h"
#include "base/trace_event/base_tracing.h"
namespace base {
namespace internal {
namespace {
constexpr size_t kMaxWorkersPerJob = …;
static_assert …;
}
JobTaskSource::State::State() = default;
JobTaskSource::State::~State() = default;
JobTaskSource::State::Value JobTaskSource::State::Cancel() { … }
JobTaskSource::State::Value JobTaskSource::State::DecrementWorkerCount() { … }
JobTaskSource::State::Value JobTaskSource::State::IncrementWorkerCount() { … }
JobTaskSource::State::Value JobTaskSource::State::Load() const { … }
JobTaskSource::JoinFlag::JoinFlag() = default;
JobTaskSource::JoinFlag::~JoinFlag() = default;
void JobTaskSource::JoinFlag::Reset() { … }
void JobTaskSource::JoinFlag::SetWaiting() { … }
bool JobTaskSource::JoinFlag::ShouldWorkerYield() { … }
bool JobTaskSource::JoinFlag::ShouldWorkerSignal() { … }
JobTaskSource::JobTaskSource(const Location& from_here,
const TaskTraits& traits,
RepeatingCallback<void(JobDelegate*)> worker_task,
MaxConcurrencyCallback max_concurrency_callback,
PooledTaskRunnerDelegate* delegate)
: … { … }
JobTaskSource::~JobTaskSource() { … }
ExecutionEnvironment JobTaskSource::GetExecutionEnvironment() { … }
void JobTaskSource::WillEnqueue(int sequence_num, TaskAnnotator& annotator) { … }
bool JobTaskSource::WillJoin() { … }
bool JobTaskSource::RunJoinTask() { … }
void JobTaskSource::Cancel(TaskSource::Transaction* transaction) { … }
bool JobTaskSource::WaitForParticipationOpportunity() { … }
TaskSource::RunStatus JobTaskSource::WillRunTask() { … }
size_t JobTaskSource::GetRemainingConcurrency() const { … }
bool JobTaskSource::IsActive() const { … }
size_t JobTaskSource::GetWorkerCount() const { … }
void JobTaskSource::NotifyConcurrencyIncrease() { … }
size_t JobTaskSource::GetMaxConcurrency() const { … }
size_t JobTaskSource::GetMaxConcurrency(size_t worker_count) const { … }
uint8_t JobTaskSource::AcquireTaskId() { … }
void JobTaskSource::ReleaseTaskId(uint8_t task_id) { … }
bool JobTaskSource::ShouldYield() { … }
Task JobTaskSource::TakeTask(TaskSource::Transaction* transaction) { … }
bool JobTaskSource::DidProcessTask(TaskSource::Transaction* ) { … }
bool JobTaskSource::WillReEnqueue(TimeTicks now,
TaskSource::Transaction* ) { … }
bool JobTaskSource::OnBecomeReady() { … }
TaskSourceSortKey JobTaskSource::GetSortKey() const { … }
TimeTicks JobTaskSource::GetDelayedSortKey() const { … }
bool JobTaskSource::HasReadyTasks(TimeTicks now) const { … }
std::optional<Task> JobTaskSource::Clear(TaskSource::Transaction* transaction) { … }
}
}