OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_WORKER_GLOBAL_SCOPE_SCHEDUL
ER_H_ |
| 6 #define THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_WORKER_GLOBAL_SCOPE_SCHEDUL
ER_H_ |
| 7 |
| 8 #include "platform/scheduler/child/web_task_runner_impl.h" |
| 9 #include "public/platform/WebCommon.h" |
| 10 #include "public/platform/scheduler/base/task_queue.h" |
| 11 |
| 12 namespace blink { |
| 13 namespace scheduler { |
| 14 |
| 15 class WorkerScheduler; |
| 16 |
| 17 // A scheduler provides per-global-scope task queues. This is constructed when a |
| 18 // global scope is created and destructed when it's closed. |
| 19 // |
| 20 // Unless stated otherwise, all methods must be called on the worker thread. |
| 21 class BLINK_PLATFORM_EXPORT WorkerGlobalScopeScheduler { |
| 22 public: |
| 23 explicit WorkerGlobalScopeScheduler(WorkerScheduler* worker_scheduler); |
| 24 ~WorkerGlobalScopeScheduler(); |
| 25 |
| 26 // Unregisters the task queues and cancels tasks in them. |
| 27 void Dispose(); |
| 28 |
| 29 // Returns the WebTaskRunner for tasks which should never get throttled. This |
| 30 // can be called from any thread. |
| 31 RefPtr<WebTaskRunner> UnthrottledTaskRunner() { |
| 32 return unthrottled_task_runner_; |
| 33 } |
| 34 |
| 35 // TODO(nhiroki): Add mechanism to throttle/suspend tasks in response to the |
| 36 // state of the parent document (https://crbug.com/670534). |
| 37 |
| 38 private: |
| 39 RefPtr<WebTaskRunnerImpl> unthrottled_task_runner_; |
| 40 |
| 41 #if DCHECK_IS_ON() |
| 42 bool is_disposed_ = false; |
| 43 #endif |
| 44 }; |
| 45 |
| 46 } // namespace scheduler |
| 47 } // namespace blink |
| 48 |
| 49 #endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_WORKER_GLOBAL_SCOPE_SCHE
DULER_H_ |
OLD | NEW |