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

Side by Side Diff: Source/platform/scheduler/Scheduler.h

Issue 976723002: Add support for postNonNestableIdleTask to the Scheduler and use it in Oilpan (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/heap/ThreadState.cpp ('k') | Source/platform/scheduler/Scheduler.cpp » ('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 Scheduler_h 5 #ifndef Scheduler_h
6 #define Scheduler_h 6 #define Scheduler_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "public/platform/WebThread.h" 9 #include "public/platform/WebThread.h"
10 #include "wtf/Functional.h" 10 #include "wtf/Functional.h"
(...skipping 13 matching lines...) Expand all
24 typedef Function<void(double deadlineSeconds)> IdleTask; 24 typedef Function<void(double deadlineSeconds)> IdleTask;
25 25
26 static Scheduler* shared(); 26 static Scheduler* shared();
27 static void setForTesting(Scheduler*); 27 static void setForTesting(Scheduler*);
28 static void shutdown(); 28 static void shutdown();
29 29
30 // For non-critical tasks which may be reordered relative to other task type s and may be starved 30 // For non-critical tasks which may be reordered relative to other task type s and may be starved
31 // for an arbitrarily long time if no idle time is available. 31 // for an arbitrarily long time if no idle time is available.
32 void postIdleTask(const WebTraceLocation&, PassOwnPtr<IdleTask>); 32 void postIdleTask(const WebTraceLocation&, PassOwnPtr<IdleTask>);
33 33
34 // Like postIdleTask but guarantees that the posted task will not run
35 // nested within an already-running task. Posting an idle task as
36 // non-nestable may not affect when the task gets run, or it could
37 // make it run later than it normally would, but it won't make it
38 // run earlier than it normally would.
39 void postNonNestableIdleTask(const WebTraceLocation&, PassOwnPtr<IdleTask>);
40
34 // Like postIdleTask but does not run the idle task until after some other 41 // Like postIdleTask but does not run the idle task until after some other
35 // task has run. This enables posting of a task which won't stop the Blink 42 // task has run. This enables posting of a task which won't stop the Blink
36 // main thread from sleeping, but will start running after it wakes up. 43 // main thread from sleeping, but will start running after it wakes up.
37 void postIdleTaskAfterWakeup(const WebTraceLocation&, PassOwnPtr<IdleTask>); 44 void postIdleTaskAfterWakeup(const WebTraceLocation&, PassOwnPtr<IdleTask>);
38 45
39 // For tasks related to loading, e.g. HTML parsing. Loading tasks usually h ave default priority 46 // For tasks related to loading, e.g. HTML parsing. Loading tasks usually h ave default priority
40 // but they may be deprioritized when the user is interacting with the devic e. 47 // but they may be deprioritized when the user is interacting with the devic e.
41 // Takes ownership of |WebThread::Task|. 48 // Takes ownership of |WebThread::Task|.
42 void postLoadingTask(const WebTraceLocation&, WebThread::Task*); 49 void postLoadingTask(const WebTraceLocation&, WebThread::Task*);
43 50
44 // Returns true if there is high priority work pending on the main thread 51 // Returns true if there is high priority work pending on the main thread
45 // and the caller should yield to let the scheduler service that work. 52 // and the caller should yield to let the scheduler service that work.
46 // Must be called on the main thread. 53 // Must be called on the main thread.
47 bool shouldYieldForHighPriorityWork() const; 54 bool shouldYieldForHighPriorityWork() const;
48 55
49 protected: 56 protected:
50 Scheduler(WebScheduler*); 57 Scheduler(WebScheduler*);
51 virtual ~Scheduler(); 58 virtual ~Scheduler();
52 59
53 static Scheduler* s_sharedScheduler; 60 static Scheduler* s_sharedScheduler;
54 WebScheduler* m_webScheduler; 61 WebScheduler* m_webScheduler;
55 }; 62 };
56 63
57 } // namespace blink 64 } // namespace blink
58 65
59 #endif // Scheduler_h 66 #endif // Scheduler_h
OLDNEW
« no previous file with comments | « Source/platform/heap/ThreadState.cpp ('k') | Source/platform/scheduler/Scheduler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698