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

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

Issue 1031843002: Move IdleTask to WebThread side 1/3 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix compile Created 5 years, 9 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
« no previous file with comments | « Source/platform/scheduler/SchedulerTest.cpp ('k') | public/platform/WebThread.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "WebCommon.h" 8 #include "WebCommon.h"
9 #include "public/platform/WebThread.h" 9 #include "public/platform/WebThread.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 class WebTraceLocation; 13 class WebTraceLocation;
14 14
15 // This class is used to submit tasks and pass other information from Blink to 15 // This class is used to submit tasks and pass other information from Blink to
16 // the platform's scheduler. 16 // the platform's scheduler.
17 class BLINK_PLATFORM_EXPORT WebScheduler { 17 class BLINK_PLATFORM_EXPORT WebScheduler {
18 public: 18 public:
19 virtual ~WebScheduler() { } 19 virtual ~WebScheduler() { }
20 20
21 // An IdleTask is passed a deadline in CLOCK_MONOTONIC seconds and is 21 typedef WebThread::IdleTask IdleTask;
22 // expected to complete before this deadline.
23 class IdleTask {
24 public:
25 virtual ~IdleTask() { }
26 virtual void run(double deadlineSeconds) = 0;
27 };
28 22
29 // Returns true if there is high priority work pending on the main thread 23 // Returns true if there is high priority work pending on the main thread
30 // and the caller should yield to let the scheduler service that work. 24 // and the caller should yield to let the scheduler service that work.
31 // Must be called on the main thread. 25 // Must be called on the main thread.
32 virtual bool shouldYieldForHighPriorityWork() { return false; } 26 virtual bool shouldYieldForHighPriorityWork() { return false; }
33 27
34 // Returns true if a currently running idle task could exceed its deadline 28 // Returns true if a currently running idle task could exceed its deadline
35 // without impacting user experience too much. This should only be used if 29 // without impacting user experience too much. This should only be used if
36 // there is a task which cannot be pre-empted and is likely to take longer 30 // there is a task which cannot be pre-empted and is likely to take longer
37 // than the largest expected idle task deadline. It should NOT be polled to 31 // than the largest expected idle task deadline. It should NOT be polled to
(...skipping 25 matching lines...) Expand all
63 // Schedule a loading task to be run on the Blink main thread. Loading 57 // Schedule a loading task to be run on the Blink main thread. Loading
64 // tasks usually have the default priority, but may be deprioritised 58 // tasks usually have the default priority, but may be deprioritised
65 // when the user is interacting with the device. 59 // when the user is interacting with the device.
66 // Takes ownership of |WebThread::Task|. Can be called from any thread. 60 // Takes ownership of |WebThread::Task|. Can be called from any thread.
67 virtual void postLoadingTask(const WebTraceLocation&, WebThread::Task*) { } 61 virtual void postLoadingTask(const WebTraceLocation&, WebThread::Task*) { }
68 }; 62 };
69 63
70 } // namespace blink 64 } // namespace blink
71 65
72 #endif // WebScheduler_h 66 #endif // WebScheduler_h
OLDNEW
« no previous file with comments | « Source/platform/scheduler/SchedulerTest.cpp ('k') | public/platform/WebThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698