chromium/cc/raster/categorized_worker_pool.cc

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

#include "cc/raster/categorized_worker_pool.h"

#include <algorithm>
#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/no_destructor.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequence_manager/task_time_observer.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/task_traits.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread_restrictions.h"
#include "base/trace_event/typed_macros.h"
#include "build/build_config.h"
#include "cc/base/math_util.h"
#include "cc/base/switches.h"
#include "cc/raster/task_category.h"

namespace cc {
namespace {

BASE_FEATURE();

// Task categories running at normal thread priority.
constexpr TaskCategory kNormalThreadPriorityCategories[] =;

// Task categories running at background thread priority.
constexpr TaskCategory kBackgroundThreadPriorityCategories[] =;

// Foreground task categories.
constexpr TaskCategory kForegroundCategories[] =;

// Background task categories. Tasks in these categories cannot start running
// when a task with a category in |kForegroundCategories| is running or ready to
// run.
constexpr TaskCategory kBackgroundCategories[] =;

// A thread which forwards to CategorizedWorkerPool::Run with the runnable
// categories.
class CategorizedWorkerPoolThread : public base::SimpleThread {};

scoped_refptr<CategorizedWorkerPool>& GetWorkerPool() {}

}  // namespace

// A sequenced task runner which posts tasks to a CategorizedWorkerPool.
class CategorizedWorkerPool::CategorizedWorkerPoolSequencedTaskRunner
    : public base::SequencedTaskRunner {};

CategorizedWorkerPoolImpl::CategorizedWorkerPoolImpl(Delegate* delegate)
    :{}

CategorizedWorkerPoolImpl::~CategorizedWorkerPoolImpl() = default;

void CategorizedWorkerPoolImpl::Start(int max_concurrency_foreground) {}

void CategorizedWorkerPoolImpl::Shutdown() {}

void CategorizedWorkerPoolImpl::ThreadWillRun(base::PlatformThreadId tid) {}

// Overridden from base::TaskRunner:
bool CategorizedWorkerPoolImpl::PostDelayedTask(const base::Location& from_here,
                                                base::OnceClosure task,
                                                base::TimeDelta delay) {}

void CategorizedWorkerPoolImpl::Run(
    const std::vector<TaskCategory>& categories,
    base::ConditionVariable* has_ready_to_run_tasks_cv) {}

void CategorizedWorkerPoolImpl::FlushForTesting() {}

void CategorizedWorkerPoolImpl::ScheduleTasks(NamespaceToken token,
                                              TaskGraph* graph) {}

void CategorizedWorkerPoolImpl::ScheduleTasksWithLockAcquired(
    NamespaceToken token,
    TaskGraph* graph) {}

bool CategorizedWorkerPoolImpl::RunTaskWithLockAcquired(
    const std::vector<TaskCategory>& categories) {}

void CategorizedWorkerPoolImpl::RunTaskInCategoryWithLockAcquired(
    TaskCategory category) {}

void CategorizedWorkerPoolImpl::SignalHasReadyToRunTasksWithLockAcquired() {}

CategorizedWorkerPoolJob::CategorizedWorkerPoolJob() = default;
CategorizedWorkerPoolJob::~CategorizedWorkerPoolJob() = default;

void CategorizedWorkerPoolJob::Start(int max_concurrency_foreground) {}

void CategorizedWorkerPoolJob::Shutdown() {}

// Overridden from base::TaskRunner:
bool CategorizedWorkerPoolJob::PostDelayedTask(const base::Location& from_here,
                                               base::OnceClosure task,
                                               base::TimeDelta delay) {}

void CategorizedWorkerPoolJob::Run(base::span<const TaskCategory> categories,
                                   base::JobDelegate* job_delegate) {}

std::optional<TaskGraphWorkQueue::PrioritizedTask>
CategorizedWorkerPoolJob::GetNextTaskToRunWithLockAcquired(
    base::span<const TaskCategory> categories) {}

void CategorizedWorkerPoolJob::FlushForTesting() {}

void CategorizedWorkerPoolJob::ScheduleTasks(NamespaceToken token,
                                             TaskGraph* graph) {}

base::JobHandle* CategorizedWorkerPoolJob::ScheduleTasksWithLockAcquired(
    NamespaceToken token,
    TaskGraph* graph) {}

base::JobHandle*
CategorizedWorkerPoolJob::GetJobHandleToNotifyWithLockAcquired() {}

size_t CategorizedWorkerPoolJob::GetMaxJobConcurrency(
    base::span<const TaskCategory> categories) const {}

CategorizedWorkerPool* CategorizedWorkerPool::GetOrCreate(Delegate* delegate) {}

CategorizedWorkerPool::CategorizedWorkerPool()
    :{}

scoped_refptr<base::SequencedTaskRunner>
CategorizedWorkerPool::CreateSequencedTaskRunner() {}

CategorizedWorkerPool::~CategorizedWorkerPool() = default;

NamespaceToken CategorizedWorkerPool::GenerateNamespaceToken() {}

void CategorizedWorkerPool::WaitForTasksToFinishRunning(NamespaceToken token) {}

void CategorizedWorkerPool::CollectCompletedTasks(
    NamespaceToken token,
    Task::Vector* completed_tasks) {}

void CategorizedWorkerPool::CollectCompletedTasksWithLockAcquired(
    NamespaceToken token,
    Task::Vector* completed_tasks) {}

bool CategorizedWorkerPool::ShouldRunTaskForCategoryWithLockAcquired(
    TaskCategory category) {}

CategorizedWorkerPool::ClosureTask::ClosureTask(base::OnceClosure closure)
    :{}

// Overridden from Task:
void CategorizedWorkerPool::ClosureTask::RunOnWorkerThread() {}

CategorizedWorkerPool::ClosureTask::~ClosureTask() {}

}  // namespace cc