Chromium Code Reviews| Index: third_party/WebKit/Source/platform/scheduler/child/global_scope_scheduler.h |
| diff --git a/third_party/WebKit/Source/platform/scheduler/child/global_scope_scheduler.h b/third_party/WebKit/Source/platform/scheduler/child/global_scope_scheduler.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..979cfb8f7d4c7ea905350258a43b769e8698b4da |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/platform/scheduler/child/global_scope_scheduler.h |
| @@ -0,0 +1,46 @@ |
| +// 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_GLOBAL_SCOPE_SCHEDULER_H_ |
| +#define THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_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 GlobalScopeScheduler { |
| + public: |
| + GlobalScopeScheduler(WorkerScheduler* worker_scheduler); |
| + ~GlobalScopeScheduler(); |
| + |
| + void dispose(); |
|
Sami
2017/04/10 16:58:10
Please document what this method does.
nhiroki
2017/04/11 10:47:54
Done.
|
| + |
| + // 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_; |
| + RefPtr<WebTaskRunnerImpl> unthrottled_task_runner_; |
| +}; |
| + |
| +} // namespace scheduler |
| +} // namespace blink |
| + |
| +#endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_GLOBAL_SCOPE_SCHEDULER_H_ |