Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: public/platform/WebScheduler.h

Issue 656323005: scheduler: Add new platform interface for implementing scheduling (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « public/platform/Platform.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 namespace blink {
9
10 class WebTraceLocation;
11
12 // This class is used to submit tasks and pass other information from Blink to
13 // the platform's scheduler.
14 class WebScheduler {
15 public:
16 virtual ~WebScheduler() { }
17
18 // An IdleTask is passed a deadline in CLOCK_MONOTONIC seconds and is
19 // expected to complete before this deadline.
20 class IdleTask {
21 public:
22 virtual ~IdleTask() { }
23 virtual void run(double deadlineSeconds) = 0;
24 };
25
26 // Called during Blink's shutdown to delete any pending tasks from the
27 // scheduler. Must be called on the main thread.
28 virtual void shutdown() { }
29
30 // 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.
32 // Must be called on the main thread.
33 virtual bool shouldYieldForHighPriorityWork() { return false; }
34
35 // 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
37 // starved for an arbitrarily long time if no idle time is available.
38 // Takes ownership of |IdleTask|. Can be called from any thread.
39 virtual void postIdleTask(const WebTraceLocation&, IdleTask*) { }
40 };
41
42 } // namespace blink
43
44 #endif // WebScheduler_h
OLDNEW
« no previous file with comments | « public/platform/Platform.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698