Chromium Code Reviews| Index: third_party/WebKit/Source/platform/scheduler/child/worker_global_scope_scheduler.h | 
| diff --git a/third_party/WebKit/Source/platform/scheduler/child/worker_global_scope_scheduler.h b/third_party/WebKit/Source/platform/scheduler/child/worker_global_scope_scheduler.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..d8e55579737bd03ee9bf8050b7f24c15407220d4 | 
| --- /dev/null | 
| +++ b/third_party/WebKit/Source/platform/scheduler/child/worker_global_scope_scheduler.h | 
| @@ -0,0 +1,47 @@ | 
| +// Copyright 2017 The Chromium Authors. All rights reserved. | 
| +// Use of this source code is governed by a BSD-style license that can be | 
| +// found in the LICENSE file. | 
| + | 
| +#ifndef THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_WORKER_GLOBAL_SCOPE_SCHEDULER_H_ | 
| +#define THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_WORKER_GLOBAL_SCOPE_SCHEDULER_H_ | 
| + | 
| +#include "platform/scheduler/child/web_task_runner_impl.h" | 
| +#include "public/platform/WebCommon.h" | 
| +#include "public/platform/scheduler/base/task_queue.h" | 
| + | 
| +namespace blink { | 
| +namespace scheduler { | 
| + | 
| +class WorkerScheduler; | 
| + | 
| +// A scheduler provides per-global-scope task queues. This is constructed when a | 
| +// global scope is created and destructed when it's closed. | 
| +// | 
| +// Unless stated otherwise, all methods must be called on the same thread. | 
| +class BLINK_PLATFORM_EXPORT WorkerGlobalScopeScheduler { | 
| + public: | 
| + WorkerGlobalScopeScheduler(WorkerScheduler* worker_scheduler); | 
| 
 
haraken
2017/04/13 07:03:36
Add explicit.
 
nhiroki
2017/04/13 08:23:50
Done.
 
 | 
| + ~WorkerGlobalScopeScheduler(); | 
| + | 
| + // Unregisters the task queues and cancels tasks in them. | 
| + void Dispose(); | 
| + | 
| + // Returns the WebTaskRunner for tasks which should never get throttled. This | 
| + // can be called from any thread. | 
| + RefPtr<WebTaskRunner> UnthrottledTaskRunner() { | 
| + return unthrottled_task_runner_; | 
| + } | 
| + | 
| + // TODO(nhiroki): Add mechanism to throttle/suspend tasks in response to the | 
| + // state of the parent document (https://crbug.com/670534). | 
| + | 
| + private: | 
| + WorkerScheduler* worker_scheduler_; | 
| + scoped_refptr<TaskQueue> unthrottled_task_queue_; | 
| 
 
haraken
2017/04/13 07:03:36
Why do we need to own unthrottled_task_queue_? I t
 
nhiroki
2017/04/13 08:23:50
Done.
WebTaskRunner already owns it. I added WebT
 
 | 
| + RefPtr<WebTaskRunnerImpl> unthrottled_task_runner_; | 
| +}; | 
| + | 
| +} // namespace scheduler | 
| +} // namespace blink | 
| + | 
| +#endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_WORKER_GLOBAL_SCOPE_SCHEDULER_H_ |