Chromium Code Reviews| 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 "public/platform/WebThread.h" | |
| 9 | |
| 8 namespace blink { | 10 namespace blink { |
| 9 | 11 |
| 10 class WebTraceLocation; | 12 class WebTraceLocation; |
| 11 | 13 |
| 12 // This class is used to submit tasks and pass other information from Blink to | 14 // This class is used to submit tasks and pass other information from Blink to |
| 13 // the platform's scheduler. | 15 // the platform's scheduler. |
| 14 class WebScheduler { | 16 class WebScheduler { |
| 15 public: | 17 public: |
| 16 virtual ~WebScheduler() { } | 18 virtual ~WebScheduler() { } |
| 17 | 19 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 30 // Returns true if there is high priority work pending on the main thread | 32 // Returns true if there is high priority work pending on the main thread |
| 31 // and the caller should yield to let the scheduler service that work. | 33 // and the caller should yield to let the scheduler service that work. |
| 32 // Must be called on the main thread. | 34 // Must be called on the main thread. |
| 33 virtual bool shouldYieldForHighPriorityWork() { return false; } | 35 virtual bool shouldYieldForHighPriorityWork() { return false; } |
| 34 | 36 |
| 35 // Schedule an idle task to run the Blink main thread. For non-critical | 37 // Schedule an idle task to run the Blink main thread. For non-critical |
| 36 // tasks which may be reordered relative to other task types and may be | 38 // tasks which may be reordered relative to other task types and may be |
| 37 // starved for an arbitrarily long time if no idle time is available. | 39 // starved for an arbitrarily long time if no idle time is available. |
| 38 // Takes ownership of |IdleTask|. Can be called from any thread. | 40 // Takes ownership of |IdleTask|. Can be called from any thread. |
| 39 virtual void postIdleTask(const WebTraceLocation&, IdleTask*) { } | 41 virtual void postIdleTask(const WebTraceLocation&, IdleTask*) { } |
| 42 | |
| 43 // Schedule a loading task to be run on the Blink main thread. Loading | |
| 44 // tasks usually have the default priority, but may be deprioritised | |
| 45 // when the user is interacting with the device. | |
| 46 // Takes ownership of |IdleTask|. Can be called from any thread. | |
|
jochen (gone - plz use gerrit)
2015/01/26 15:53:31
nit. WebThread::Task instead of IdleTask
alex clarke (OOO till 29th)
2015/01/26 17:00:45
Done.
| |
| 47 virtual void postLoadingTask(const WebTraceLocation&, WebThread::Task*) { } | |
| 40 }; | 48 }; |
| 41 | 49 |
| 42 } // namespace blink | 50 } // namespace blink |
| 43 | 51 |
| 44 #endif // WebScheduler_h | 52 #endif // WebScheduler_h |
| OLD | NEW |