Commit 367a8a06 authored by Hiroki Nakagawa's avatar Hiroki Nakagawa Committed by Commit Bot

Worker: Update comments about task runners for worker threads

Bug: 624696
Change-Id: I1a501ec3b90dc135fef41274818b94dd80557cc1
Reviewed-on: https://chromium-review.googlesource.com/972782Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544818}
parent b53d2327
......@@ -202,7 +202,11 @@ class CORE_EXPORT WorkerThread : public WebThread::TaskObserver {
return nullptr;
}
// Can be called on both the main thread and the worker thread.
// Returns a task runner bound to the per-global-scope scheduler's task queue.
// You don't have to care about the lifetime of the associated global scope
// and underlying thread. After the global scope is destroyed, queued tasks
// are discarded and PostTask on the returned task runner just fails. This
// function can be called on both the main thread and the worker thread.
scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner(TaskType type) {
return global_scope_scheduler_->GetTaskRunner(type);
}
......
......@@ -184,9 +184,9 @@ class Database final : public ScriptWrappable {
scoped_refptr<const SecurityOrigin> database_thread_security_origin_;
Member<DatabaseContext>
database_context_; // Associated with m_executionContext.
// TaskRunnerHelper::get is not thread-safe, so we save SingleThreadTaskRunner
// for TaskType::DatabaseAccess for later use as the constructor runs in the
// main thread.
// ExecutionContext::GetTaskRunner() is not thread-safe, so we save
// SingleThreadTaskRunner for TaskType::DatabaseAccess for later use as the
// constructor runs in the main thread.
scoped_refptr<base::SingleThreadTaskRunner> database_task_runner_;
String name_;
......
......@@ -30,7 +30,7 @@ class PLATFORM_EXPORT WorkerGlobalScopeScheduler {
// Returns a task runner that is suitable with the given task type. This can
// be called from any thread.
//
// This must be called only from TaskRunnerHelper::Get().
// This must be called only from WorkerThread::GetTaskRunner().
scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner(TaskType) const;
// TODO(nhiroki): Add mechanism to throttle/suspend tasks in response to the
......
......@@ -77,12 +77,12 @@ class BLINK_PLATFORM_EXPORT WebThread {
virtual void DidProcessTask() = 0;
};
// DEPRECATED: Returns a WebTaskRunner bound to the underlying scheduler's
// DEPRECATED: Returns a task runner bound to the underlying scheduler's
// default task queue.
//
// Default scheduler task queue does not give scheduler enough freedom to
// manage task priorities and should not be used.
// Use TaskRunnerHelper::Get instead (crbug.com/624696).
// Use ExecutionContext::GetTaskRunner instead (crbug.com/624696).
virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() const {
return nullptr;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment