Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WebScheduler_h | |
| 6 #define WebScheduler_h | |
| 7 | |
| 8 #include "WebThread.h" | |
| 9 | |
| 10 namespace blink { | |
| 11 | |
| 12 class WebTraceLocation; | |
| 13 | |
| 14 // This class is used to submit tasks and pass other information from Blink to | |
| 15 // the platform's scheduler. | |
| 16 class WebScheduler { | |
| 17 public: | |
| 18 virtual ~WebScheduler() { } | |
| 19 | |
| 20 // An IdleTask is passed a deadline in CLOCK_MONOTONIC seconds and is | |
| 21 // expected to complete before this deadline. | |
| 22 class IdleTask { | |
| 23 public: | |
| 24 virtual ~IdleTask() { } | |
| 25 virtual void run(double deadlineSeconds) = 0; | |
| 26 }; | |
| 27 | |
| 28 // Called during Blink's shutdown to delete any pending tasks from the | |
| 29 // scheduler. Must be alled on the main thread. | |
|
rmcilroy
2014/10/21 13:24:19
/s/alled/called :)
Sami
2014/10/21 13:54:12
Yeah, sounds better that way :)
| |
| 30 virtual void shutdown() { } | |
| 31 | |
| 32 // Returns true if there is high priority work pending on the main thread | |
| 33 // and the caller should yield to let the scheduler service that work. | |
| 34 // Must be called on the main thread. | |
| 35 virtual bool shouldYieldForHighPriorityWork() { return false; } | |
| 36 | |
| 37 // Schedule an idle task to run the Blink main thread. For non-critical | |
| 38 // tasks which may be reordered relative to other task types and may be | |
| 39 // starved for an arbitrarily long time if no idle time is available. | |
| 40 // Takes ownership of |IdleTask|. Can be called from any thread. | |
| 41 virtual void postIdleTask(const WebTraceLocation&, IdleTask*) { } | |
| 42 }; | |
| 43 | |
| 44 } // namespace blink | |
| 45 | |
| 46 #endif // WebScheduler_h | |
| OLD | NEW |