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 Scheduler_h | 5 #ifndef Scheduler_h |
6 #define Scheduler_h | 6 #define Scheduler_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "public/platform/WebThread.h" | 9 #include "public/platform/WebThread.h" |
10 #include "wtf/Functional.h" | 10 #include "wtf/Functional.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // For tasks related to loading, e.g. HTML parsing. Loading tasks usually h
ave default priority | 39 // For tasks related to loading, e.g. HTML parsing. Loading tasks usually h
ave default priority |
40 // but they may be deprioritized when the user is interacting with the devic
e. | 40 // but they may be deprioritized when the user is interacting with the devic
e. |
41 // Takes ownership of |WebThread::Task|. | 41 // Takes ownership of |WebThread::Task|. |
42 void postLoadingTask(const WebTraceLocation&, WebThread::Task*); | 42 void postLoadingTask(const WebTraceLocation&, WebThread::Task*); |
43 | 43 |
44 // Returns true if there is high priority work pending on the main thread | 44 // Returns true if there is high priority work pending on the main thread |
45 // and the caller should yield to let the scheduler service that work. | 45 // and the caller should yield to let the scheduler service that work. |
46 // Must be called on the main thread. | 46 // Must be called on the main thread. |
47 bool shouldYieldForHighPriorityWork() const; | 47 bool shouldYieldForHighPriorityWork() const; |
48 | 48 |
| 49 // Returns true if a currently running idle task could exceed its deadline |
| 50 // without impacting user experience too much. This should only be used if |
| 51 // there is a task which cannot be pre-empted and is likely to take longer |
| 52 // than the largest expected idle task deadline. It should NOT be polled to |
| 53 // check whether more work can be performed on the current idle task after |
| 54 // its deadline has expired - post a new idle task for the continuation of |
| 55 // the work in this case. |
| 56 // Must be called from the main thread. |
| 57 bool canExceedIdleDeadlineIfRequired() const; |
| 58 |
49 protected: | 59 protected: |
50 Scheduler(WebScheduler*); | 60 Scheduler(WebScheduler*); |
51 virtual ~Scheduler(); | 61 virtual ~Scheduler(); |
52 | 62 |
53 static Scheduler* s_sharedScheduler; | 63 static Scheduler* s_sharedScheduler; |
54 WebScheduler* m_webScheduler; | 64 WebScheduler* m_webScheduler; |
55 }; | 65 }; |
56 | 66 |
57 } // namespace blink | 67 } // namespace blink |
58 | 68 |
59 #endif // Scheduler_h | 69 #endif // Scheduler_h |
OLD | NEW |