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..0b36a27c7dabe43697c3841e92c3ffdf3ada46b7 |
| --- /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. |
|
haraken
2017/04/17 14:49:52
on the worker thread?
nhiroki
2017/04/18 05:34:38
Done.
|
| +class BLINK_PLATFORM_EXPORT WorkerGlobalScopeScheduler { |
| + public: |
| + explicit WorkerGlobalScopeScheduler(WorkerScheduler* worker_scheduler); |
| + ~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: |
| + RefPtr<WebTaskRunnerImpl> unthrottled_task_runner_; |
| + |
| + bool is_enabled_ = true; |
|
haraken
2017/04/17 14:49:52
is_enabled_ => is_disposed_
Also can we put this
nhiroki
2017/04/18 05:34:38
Done.
|
| +}; |
| + |
| +} // namespace scheduler |
| +} // namespace blink |
| + |
| +#endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_WORKER_GLOBAL_SCOPE_SCHEDULER_H_ |