OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WebScheduler_h | 5 #ifndef WebScheduler_h |
6 #define WebScheduler_h | 6 #define WebScheduler_h |
7 | 7 |
8 #include "WebCommon.h" | 8 #include "WebCommon.h" |
9 #include "public/platform/WebThread.h" | 9 #include "public/platform/WebThread.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class WebTraceLocation; | 13 class WebTraceLocation; |
14 | 14 |
15 // This class is used to submit tasks and pass other information from Blink to | 15 // This class is used to submit tasks and pass other information from Blink to |
16 // the platform's scheduler. | 16 // the platform's scheduler. |
17 class BLINK_PLATFORM_EXPORT WebScheduler { | 17 class BLINK_PLATFORM_EXPORT WebScheduler { |
18 public: | 18 public: |
19 virtual ~WebScheduler() { } | 19 virtual ~WebScheduler() { } |
20 | 20 |
| 21 // Called to prevent any more pending tasks from running. Must be called on |
| 22 // the associated WebThread. |
| 23 virtual void shutdown() { } |
| 24 |
21 // Returns true if there is high priority work pending on the associated Web
Thread | 25 // Returns true if there is high priority work pending on the associated Web
Thread |
22 // and the caller should yield to let the scheduler service that work. | 26 // and the caller should yield to let the scheduler service that work. |
23 // Must be called on the associated WebThread. | 27 // Must be called on the associated WebThread. |
24 virtual bool shouldYieldForHighPriorityWork() { return false; } | 28 virtual bool shouldYieldForHighPriorityWork() { return false; } |
25 | 29 |
26 // Returns true if a currently running idle task could exceed its deadline | 30 // Returns true if a currently running idle task could exceed its deadline |
27 // without impacting user experience too much. This should only be used if | 31 // without impacting user experience too much. This should only be used if |
28 // there is a task which cannot be pre-empted and is likely to take longer | 32 // there is a task which cannot be pre-empted and is likely to take longer |
29 // than the largest expected idle task deadline. It should NOT be polled to | 33 // than the largest expected idle task deadline. It should NOT be polled to |
30 // check whether more work can be performed on the current idle task after | 34 // check whether more work can be performed on the current idle task after |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 void postIdleTask(const WebTraceLocation&, PassOwnPtr<IdleTask>); | 76 void postIdleTask(const WebTraceLocation&, PassOwnPtr<IdleTask>); |
73 void postNonNestableIdleTask(const WebTraceLocation&, PassOwnPtr<IdleTask>); | 77 void postNonNestableIdleTask(const WebTraceLocation&, PassOwnPtr<IdleTask>); |
74 void postIdleTaskAfterWakeup(const WebTraceLocation&, PassOwnPtr<IdleTask>); | 78 void postIdleTaskAfterWakeup(const WebTraceLocation&, PassOwnPtr<IdleTask>); |
75 void postLoadingTask(const WebTraceLocation&, PassOwnPtr<Task>); | 79 void postLoadingTask(const WebTraceLocation&, PassOwnPtr<Task>); |
76 #endif | 80 #endif |
77 }; | 81 }; |
78 | 82 |
79 } // namespace blink | 83 } // namespace blink |
80 | 84 |
81 #endif // WebScheduler_h | 85 #endif // WebScheduler_h |
OLD | NEW |