#include "third_party/blink/renderer/platform/scheduler/common/idle_helper.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/memory/scoped_refptr.h"
#include "base/task/sequence_manager/sequence_manager.h"
#include "base/task/sequence_manager/task_queue.h"
#include "base/task/sequence_manager/time_domain.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/traced_value.h"
#include "third_party/blink/renderer/platform/scheduler/common/blink_scheduler_single_thread_task_runner.h"
#include "third_party/blink/renderer/platform/scheduler/common/scheduler_helper.h"
#include "third_party/blink/renderer/platform/scheduler/common/task_priority.h"
namespace blink {
namespace scheduler {
TaskQueue;
constexpr base::TimeDelta IdleHelper::kMaximumIdlePeriod;
IdleHelper::IdleHelper(
SchedulerHelper* helper,
Delegate* delegate,
const char* idle_period_tracing_name,
base::TimeDelta required_quiescence_duration_before_long_idle_period,
TaskQueue* idle_queue)
: … { … }
IdleHelper::~IdleHelper() { … }
void IdleHelper::Shutdown() { … }
IdleHelper::Delegate::Delegate() = default;
IdleHelper::Delegate::~Delegate() = default;
scoped_refptr<SingleThreadIdleTaskRunner> IdleHelper::IdleTaskRunner() { … }
IdleHelper::IdlePeriodState IdleHelper::ComputeNewLongIdlePeriodState(
const base::TimeTicks now,
base::TimeDelta* next_long_idle_period_delay_out) { … }
bool IdleHelper::ShouldWaitForQuiescence() { … }
void IdleHelper::EnableLongIdlePeriod() { … }
void IdleHelper::StartIdlePeriod(IdlePeriodState new_state,
base::TimeTicks now,
base::TimeTicks idle_period_deadline) { … }
void IdleHelper::EndIdlePeriod() { … }
void IdleHelper::WillProcessTask(const base::PendingTask& pending_task,
bool was_blocked_or_low_priority) { … }
void IdleHelper::DidProcessTask(const base::PendingTask& pending_task) { … }
void IdleHelper::UpdateLongIdlePeriodStateAfterIdleTask() { … }
base::TimeTicks IdleHelper::CurrentIdleTaskDeadline() const { … }
void IdleHelper::OnIdleTaskPosted() { … }
void IdleHelper::OnIdleTaskPostedOnMainThread() { … }
base::TimeTicks IdleHelper::WillProcessIdleTask() { … }
void IdleHelper::DidProcessIdleTask() { … }
base::TimeTicks IdleHelper::NowTicks() { … }
bool IdleHelper::IsInIdlePeriod(IdlePeriodState state) { … }
bool IdleHelper::IsInLongIdlePeriod(IdlePeriodState state) { … }
bool IdleHelper::CanExceedIdleDeadlineIfRequired() const { … }
IdleHelper::IdlePeriodState IdleHelper::SchedulerIdlePeriodState() const { … }
IdleHelper::State::State(SchedulerHelper* helper,
Delegate* delegate,
const char* idle_period_tracing_name)
: … { … }
IdleHelper::State::~State() = default;
IdleHelper::IdlePeriodState IdleHelper::State::idle_period_state() const { … }
base::TimeTicks IdleHelper::State::idle_period_deadline() const { … }
void IdleHelper::State::UpdateState(IdlePeriodState new_state,
base::TimeTicks new_deadline,
base::TimeTicks optional_now) { … }
void IdleHelper::State::TraceIdleIdleTaskStart() { … }
void IdleHelper::State::TraceIdleIdleTaskEnd() { … }
void IdleHelper::State::TraceEventIdlePeriodStateChange(
IdlePeriodState new_state,
bool new_running_idle_task,
base::TimeTicks new_deadline,
base::TimeTicks now) { … }
const char* IdleHelper::IdlePeriodStateToString(
IdlePeriodState idle_period_state) { … }
}
}