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 same thread. | |
21 class BLINK_PLATFORM_EXPORT WorkerGlobalScopeScheduler { | |
22 public: | |
23 WorkerGlobalScopeScheduler(WorkerScheduler* worker_scheduler); | |
24 ~WorkerGlobalScopeScheduler(); | |
25 | |
26 // Unregisters the task queues and cancels tasks in them. | |
27 void Dispose(); | |
Sami
2017/04/12 15:54:07
Could you add a test for this please?
nhiroki
2017/04/13 08:23:50
Done.
| |
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 WorkerScheduler* worker_scheduler_; | |
40 scoped_refptr<TaskQueue> unthrottled_task_queue_; | |
41 RefPtr<WebTaskRunnerImpl> unthrottled_task_runner_; | |
42 }; | |
43 | |
44 } // namespace scheduler | |
45 } // namespace blink | |
46 | |
47 #endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_WORKER_GLOBAL_SCOPE_SCHE DULER_H_ | |
OLD | NEW |