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

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

Issue 876623002: Adds a CancellableTaskFactory and exposes postLoadingTasks to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 10 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/wtf/WeakPtr.h ('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 10
10 namespace blink { 11 namespace blink {
11 12
12 class WebTraceLocation; 13 class WebTraceLocation;
13 14
14 // 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
15 // the platform's scheduler. 16 // the platform's scheduler.
16 class BLINK_PLATFORM_EXPORT WebScheduler { 17 class BLINK_PLATFORM_EXPORT WebScheduler {
17 public: 18 public:
18 virtual ~WebScheduler() { } 19 virtual ~WebScheduler() { }
(...skipping 13 matching lines...) Expand all
32 // Returns true if there is high priority work pending on the main thread 33 // 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 // and the caller should yield to let the scheduler service that work.
34 // Must be called on the main thread. 35 // Must be called on the main thread.
35 virtual bool shouldYieldForHighPriorityWork() { return false; } 36 virtual bool shouldYieldForHighPriorityWork() { return false; }
36 37
37 // Schedule an idle task to run the Blink main thread. For non-critical 38 // 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 // 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 // starved for an arbitrarily long time if no idle time is available.
40 // Takes ownership of |IdleTask|. Can be called from any thread. 41 // Takes ownership of |IdleTask|. Can be called from any thread.
41 virtual void postIdleTask(const WebTraceLocation&, IdleTask*) { } 42 virtual void postIdleTask(const WebTraceLocation&, IdleTask*) { }
43
44 // Schedule a loading task to be run on the Blink main thread. Loading
45 // tasks usually have the default priority, but may be deprioritised
46 // when the user is interacting with the device.
47 // Takes ownership of |WebThread::Task|. Can be called from any thread.
48 virtual void postLoadingTask(const WebTraceLocation&, WebThread::Task*) { }
42 }; 49 };
43 50
44 } // namespace blink 51 } // namespace blink
45 52
46 #endif // WebScheduler_h 53 #endif // WebScheduler_h
OLDNEW
« no previous file with comments | « Source/wtf/WeakPtr.h ('k') | public/platform/WebThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698