#include "content/browser/scheduler/browser_ui_thread_scheduler.h"
#include <utility>
#include "base/feature_list.h"
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_pump.h"
#include "base/message_loop/message_pump_type.h"
#include "base/notreached.h"
#include "base/process/process.h"
#include "base/run_loop.h"
#include "base/task/sequence_manager/sequence_manager.h"
#include "base/task/sequence_manager/sequence_manager_impl.h"
#include "base/task/sequence_manager/task_queue.h"
#include "base/task/sequence_manager/time_domain.h"
#include "base/threading/platform_thread.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "content/browser/scheduler/browser_task_priority.h"
#include "content/browser/scheduler/browser_task_queues.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_features.h"
namespace {
content::BrowserUIThreadScheduler* g_browser_ui_thread_scheduler = …;
bool IsActiveScrollState(
content::BrowserUIThreadScheduler::ScrollState scroll_state) { … }
}
namespace content {
namespace features {
BASE_FEATURE(…);
constexpr base::FeatureParam<base::TimeDelta>
kBrowserPrioritizeNativeWorkAfterInputForNMsParam{ … };
BASE_FEATURE(…);
constexpr base::FeatureParam<bool> kDeferNormalOrLessPriorityTasks{ … };
constexpr base::FeatureParam<bool> kDeferKnownLongRunningTasks{ … };
}
BrowserUIThreadScheduler::UserInputActiveHandle::UserInputActiveHandle(
BrowserUIThreadScheduler* scheduler)
: … { … }
BrowserUIThreadScheduler::UserInputActiveHandle::UserInputActiveHandle(
UserInputActiveHandle&& other) { … }
BrowserUIThreadScheduler::UserInputActiveHandle&
BrowserUIThreadScheduler::UserInputActiveHandle::operator=(
UserInputActiveHandle&& other) { … }
void BrowserUIThreadScheduler::UserInputActiveHandle::MoveFrom(
UserInputActiveHandle* other) { … }
BrowserUIThreadScheduler::UserInputActiveHandle::~UserInputActiveHandle() { … }
BrowserUIThreadScheduler::~BrowserUIThreadScheduler() = default;
std::unique_ptr<BrowserUIThreadScheduler>
BrowserUIThreadScheduler::CreateForTesting(
base::sequence_manager::SequenceManager* sequence_manager) { … }
BrowserUIThreadScheduler* BrowserUIThreadScheduler::Get() { … }
BrowserUIThreadScheduler::BrowserUIThreadScheduler()
: … { … }
BrowserUIThreadScheduler::BrowserUIThreadScheduler(
base::sequence_manager::SequenceManager* sequence_manager)
: … { … }
void BrowserUIThreadScheduler::CommonSequenceManagerSetup(
base::sequence_manager::SequenceManager* sequence_manager) { … }
BrowserUIThreadScheduler::UserInputActiveHandle
BrowserUIThreadScheduler::OnUserInputStart() { … }
void BrowserUIThreadScheduler::DidStartUserInput() { … }
void BrowserUIThreadScheduler::OnScrollStateUpdate(ScrollState scroll_state) { … }
void BrowserUIThreadScheduler::UpdatePolicyOnScrollStateUpdate(
ScrollState old_state,
ScrollState new_state) { … }
void BrowserUIThreadScheduler::UpdateTaskQueueStates() { … }
bool BrowserUIThreadScheduler::Policy::IsQueueEnabled(
BrowserTaskQueues::QueueType task_queue) const { … }
void BrowserUIThreadScheduler::DidEndUserInput() { … }
void BrowserUIThreadScheduler::PostFeatureListSetup() { … }
void BrowserUIThreadScheduler::EnableBrowserPrioritizesNativeWork() { … }
void BrowserUIThreadScheduler::EnableDeferringBrowserUIThreadTasks() { … }
}