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 | |
25 // Returns true if there is high priority work pending on the associated Web
Thread | 21 // Returns true if there is high priority work pending on the associated Web
Thread |
26 // and the caller should yield to let the scheduler service that work. | 22 // and the caller should yield to let the scheduler service that work. |
27 // Must be called on the associated WebThread. | 23 // Must be called on the associated WebThread. |
28 virtual bool shouldYieldForHighPriorityWork() { return false; } | 24 virtual bool shouldYieldForHighPriorityWork() { return false; } |
29 | 25 |
30 // Returns true if a currently running idle task could exceed its deadline | 26 // Returns true if a currently running idle task could exceed its deadline |
31 // without impacting user experience too much. This should only be used if | 27 // without impacting user experience too much. This should only be used if |
32 // there is a task which cannot be pre-empted and is likely to take longer | 28 // there is a task which cannot be pre-empted and is likely to take longer |
33 // than the largest expected idle task deadline. It should NOT be polled to | 29 // than the largest expected idle task deadline. It should NOT be polled to |
34 // check whether more work can be performed on the current idle task after | 30 // 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... |
76 void postIdleTask(const WebTraceLocation&, PassOwnPtr<IdleTask>); | 72 void postIdleTask(const WebTraceLocation&, PassOwnPtr<IdleTask>); |
77 void postNonNestableIdleTask(const WebTraceLocation&, PassOwnPtr<IdleTask>); | 73 void postNonNestableIdleTask(const WebTraceLocation&, PassOwnPtr<IdleTask>); |
78 void postIdleTaskAfterWakeup(const WebTraceLocation&, PassOwnPtr<IdleTask>); | 74 void postIdleTaskAfterWakeup(const WebTraceLocation&, PassOwnPtr<IdleTask>); |
79 void postLoadingTask(const WebTraceLocation&, PassOwnPtr<Task>); | 75 void postLoadingTask(const WebTraceLocation&, PassOwnPtr<Task>); |
80 #endif | 76 #endif |
81 }; | 77 }; |
82 | 78 |
83 } // namespace blink | 79 } // namespace blink |
84 | 80 |
85 #endif // WebScheduler_h | 81 #endif // WebScheduler_h |
OLD | NEW |