chromium/content/browser/scheduler/browser_ui_thread_scheduler.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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
namespace content {

namespace features {
// When the "BrowserPrioritizeNativeWork" feature is enabled, the main thread
// will process native messages between each batch of application tasks for some
// duration after an input event. The duration is controlled by the
// "prioritize_for_next_ms" feature param. Special case: If
// "prioritize_for_next_ms" is TimeDelta::Max(), native messages will be
// processed between each batch of application tasks, independently from input
// events.
//
// The goal is to reduce jank by processing subsequent input events sooner after
// a first input event is received. Checking for native messages more frequently
// incurs some overhead, but allows the browser to handle input more
// consistently.
BASE_FEATURE();
constexpr base::FeatureParam<base::TimeDelta>
    kBrowserPrioritizeNativeWorkAfterInputForNMsParam{};

// Feature to defer tasks on the UI thread to prioritise input.
BASE_FEATURE();

constexpr base::FeatureParam<bool> kDeferNormalOrLessPriorityTasks{};

constexpr base::FeatureParam<bool> kDeferKnownLongRunningTasks{};
}  // namespace features

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;

// static
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() {}

}  // namespace content