From 05b86a38c19a75b1c9cb89a22ca9439e3f332929 Mon Sep 17 00:00:00 2001 From: Attila Uygun Date: Tue, 6 Jun 2023 23:46:03 +0200 Subject: [PATCH] Add comments --- src/base/task_runner.cc | 4 ++++ src/base/task_runner.h | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/base/task_runner.cc b/src/base/task_runner.cc index fa8f670..ebde0e4 100644 --- a/src/base/task_runner.cc +++ b/src/base/task_runner.cc @@ -20,6 +20,10 @@ void PostTaskAndReplyRelay(base::Location from, namespace base { +// The task runner that belongs to the thread it's created in. Tasks to be run +// on a specific thread can be posted to this task runner. +// TaskRunner::GetThreadLocalTaskRunner()->SingleConsumerRun() is expected to be +// periodically called. thread_local std::unique_ptr TaskRunner::thread_local_task_runner; void TaskRunner::CreateThreadLocalTaskRunner() { diff --git a/src/base/task_runner.h b/src/base/task_runner.h index c3ef81f..49442a6 100644 --- a/src/base/task_runner.h +++ b/src/base/task_runner.h @@ -34,9 +34,9 @@ void ReplyAdapter(std::function callback, // Runs queued tasks (in the form of Closure objects). All methods are // thread-safe and can be called on any thread. -// Tasks run in FIFO order. When consumed concurrently by multiple threads, it -// doesn't guarantee whether tasks overlap, or whether they run on a particular -// thread. +// Tasks run in FIFO order when consumed by a single thread. When consumed +// concurrently by multiple threads, it doesn't guarantee whether tasks overlap, +// or whether they run on a particular thread. class TaskRunner { public: TaskRunner() = default;