#include "base/task/sequence_manager/thread_controller_impl.h"
#include <algorithm>
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_pump.h"
#include "base/notreached.h"
#include "base/run_loop.h"
#include "base/task/common/lazy_now.h"
#include "base/task/sequence_manager/sequence_manager_impl.h"
#include "base/task/sequence_manager/sequenced_task_source.h"
#include "base/trace_event/base_tracing.h"
#include "build/build_config.h"
namespace base {
namespace sequence_manager {
namespace internal {
ShouldScheduleWork;
ThreadControllerImpl::ThreadControllerImpl(
SequenceManagerImpl* funneled_sequence_manager,
scoped_refptr<SingleThreadTaskRunner> task_runner,
const TickClock* time_source)
: … { … }
ThreadControllerImpl::~ThreadControllerImpl() { … }
ThreadControllerImpl::MainSequenceOnly::MainSequenceOnly() = default;
ThreadControllerImpl::MainSequenceOnly::~MainSequenceOnly() = default;
std::unique_ptr<ThreadControllerImpl> ThreadControllerImpl::Create(
SequenceManagerImpl* funneled_sequence_manager,
const TickClock* time_source) { … }
void ThreadControllerImpl::SetSequencedTaskSource(
SequencedTaskSource* sequence) { … }
void ThreadControllerImpl::ScheduleWork() { … }
void ThreadControllerImpl::SetNextDelayedDoWork(LazyNow* lazy_now,
std::optional<WakeUp> wake_up) { … }
bool ThreadControllerImpl::RunsTasksInCurrentSequence() { … }
void ThreadControllerImpl::SetDefaultTaskRunner(
scoped_refptr<SingleThreadTaskRunner> task_runner) { … }
scoped_refptr<SingleThreadTaskRunner>
ThreadControllerImpl::GetDefaultTaskRunner() { … }
void ThreadControllerImpl::RestoreDefaultTaskRunner() { … }
void ThreadControllerImpl::BindToCurrentThread(
std::unique_ptr<MessagePump> message_pump) { … }
void ThreadControllerImpl::WillQueueTask(PendingTask* pending_task) { … }
void ThreadControllerImpl::DoWork(WorkType work_type) { … }
void ThreadControllerImpl::AddNestingObserver(
RunLoop::NestingObserver* observer) { … }
void ThreadControllerImpl::RemoveNestingObserver(
RunLoop::NestingObserver* observer) { … }
void ThreadControllerImpl::OnBeginNestedRunLoop() { … }
void ThreadControllerImpl::OnExitNestedRunLoop() { … }
void ThreadControllerImpl::SetWorkBatchSize(int work_batch_size) { … }
void ThreadControllerImpl::SetTaskExecutionAllowedInNativeNestedLoop(
bool allowed) { … }
bool ThreadControllerImpl::IsTaskExecutionAllowed() const { … }
bool ThreadControllerImpl::ShouldQuitRunLoopWhenIdle() { … }
MessagePump* ThreadControllerImpl::GetBoundMessagePump() const { … }
#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_ANDROID)
void ThreadControllerImpl::AttachToMessagePump() {
NOTREACHED();
}
#endif
#if BUILDFLAG(IS_IOS)
void ThreadControllerImpl::DetachFromMessagePump() {
NOTREACHED();
}
#endif
void ThreadControllerImpl::PrioritizeYieldingToNative(base::TimeTicks) { … }
}
}
}