| 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 30 matching lines...) Expand all Loading... |
| 41 // Like postIdleTask but does not run the idle task until after some other | 41 // Like postIdleTask but does not run the idle task until after some other |
| 42 // task has run. This enables posting of a task which won't stop the Blink | 42 // task has run. This enables posting of a task which won't stop the Blink |
| 43 // main thread from sleeping, but will start running after it wakes up. | 43 // main thread from sleeping, but will start running after it wakes up. |
| 44 void postIdleTaskAfterWakeup(const WebTraceLocation&, PassOwnPtr<IdleTask>); | 44 void postIdleTaskAfterWakeup(const WebTraceLocation&, PassOwnPtr<IdleTask>); |
| 45 | 45 |
| 46 // For tasks related to loading, e.g. HTML parsing. Loading tasks usually h
ave default priority | 46 // For tasks related to loading, e.g. HTML parsing. Loading tasks usually h
ave default priority |
| 47 // but they may be deprioritized when the user is interacting with the devic
e. | 47 // but they may be deprioritized when the user is interacting with the devic
e. |
| 48 // Takes ownership of |WebThread::Task|. | 48 // Takes ownership of |WebThread::Task|. |
| 49 void postLoadingTask(const WebTraceLocation&, WebThread::Task*); | 49 void postLoadingTask(const WebTraceLocation&, WebThread::Task*); |
| 50 | 50 |
| 51 // For Blink Timer tasks, e.g. DOMTimers, Can only be called from the blink
main thread. |
| 52 // Takes ownership of |WebThread::Task|. |
| 53 void postTimerTask(const WebTraceLocation&, WebThread::Task*, long long dela
yMs); |
| 54 |
| 51 // Returns true if there is high priority work pending on the main thread | 55 // Returns true if there is high priority work pending on the main thread |
| 52 // and the caller should yield to let the scheduler service that work. | 56 // and the caller should yield to let the scheduler service that work. |
| 53 // Must be called on the main thread. | 57 // Must be called on the main thread. |
| 54 bool shouldYieldForHighPriorityWork() const; | 58 bool shouldYieldForHighPriorityWork() const; |
| 55 | 59 |
| 56 // Returns true if a currently running idle task could exceed its deadline | 60 // Returns true if a currently running idle task could exceed its deadline |
| 57 // without impacting user experience too much. This should only be used if | 61 // without impacting user experience too much. This should only be used if |
| 58 // there is a task which cannot be pre-empted and is likely to take longer | 62 // there is a task which cannot be pre-empted and is likely to take longer |
| 59 // than the largest expected idle task deadline. It should NOT be polled to | 63 // than the largest expected idle task deadline. It should NOT be polled to |
| 60 // check whether more work can be performed on the current idle task after | 64 // check whether more work can be performed on the current idle task after |
| 61 // its deadline has expired - post a new idle task for the continuation of | 65 // its deadline has expired - post a new idle task for the continuation of |
| 62 // the work in this case. | 66 // the work in this case. |
| 63 // Must be called from the main thread. | 67 // Must be called from the main thread. |
| 64 bool canExceedIdleDeadlineIfRequired() const; | 68 bool canExceedIdleDeadlineIfRequired() const; |
| 65 | 69 |
| 66 protected: | 70 protected: |
| 67 Scheduler(WebScheduler*); | 71 Scheduler(WebScheduler*); |
| 68 virtual ~Scheduler(); | 72 virtual ~Scheduler(); |
| 69 | 73 |
| 70 static Scheduler* s_sharedScheduler; | 74 static Scheduler* s_sharedScheduler; |
| 71 WebScheduler* m_webScheduler; | 75 WebScheduler* m_webScheduler; |
| 72 }; | 76 }; |
| 73 | 77 |
| 74 } // namespace blink | 78 } // namespace blink |
| 75 | 79 |
| 76 #endif // Scheduler_h | 80 #endif // Scheduler_h |
| OLD | NEW |