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

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

Issue 940433005: Add postIdleTaskAfterWakeup to WebScheduler. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 12 matching lines...) Expand all
23 // An IdleTask is passed a deadline in CLOCK_MONOTONIC seconds and is expect ed to complete before this deadline. 23 // An IdleTask is passed a deadline in CLOCK_MONOTONIC seconds and is expect ed to complete before this deadline.
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 shutdown(); 27 static void shutdown();
28 28
29 // For non-critical tasks which may be reordered relative to other task type s and may be starved 29 // For non-critical tasks which may be reordered relative to other task type s and may be starved
30 // for an arbitrarily long time if no idle time is available. 30 // for an arbitrarily long time if no idle time is available.
31 void postIdleTask(const WebTraceLocation&, PassOwnPtr<IdleTask>); 31 void postIdleTask(const WebTraceLocation&, PassOwnPtr<IdleTask>);
32 32
33 // Like postIdleTask but does not run the idle task until after some other
34 // task has run. This enables posting of a task which won't stop the Blink
35 // main thread from sleeping, but will start running after it wakes up.
36 void postIdleTaskAfterWakeup(const WebTraceLocation&, PassOwnPtr<IdleTask>);
37
33 // For tasks related to loading, e.g. HTML parsing. Loading tasks usually h ave default priority 38 // For tasks related to loading, e.g. HTML parsing. Loading tasks usually h ave default priority
34 // but they may be deprioritized when the user is interacting with the devic e. 39 // but they may be deprioritized when the user is interacting with the devic e.
35 // Takes ownership of |WebThread::Task|. 40 // Takes ownership of |WebThread::Task|.
36 void postLoadingTask(const WebTraceLocation&, WebThread::Task*); 41 void postLoadingTask(const WebTraceLocation&, WebThread::Task*);
37 42
38 // Returns true if there is high priority work pending on the main thread 43 // Returns true if there is high priority work pending on the main thread
39 // and the caller should yield to let the scheduler service that work. 44 // and the caller should yield to let the scheduler service that work.
40 // Must be called on the main thread. 45 // Must be called on the main thread.
41 bool shouldYieldForHighPriorityWork() const; 46 bool shouldYieldForHighPriorityWork() const;
42 47
43 protected: 48 protected:
44 Scheduler(WebScheduler*); 49 Scheduler(WebScheduler*);
45 virtual ~Scheduler(); 50 virtual ~Scheduler();
46 51
47 static Scheduler* s_sharedScheduler; 52 static Scheduler* s_sharedScheduler;
48 WebScheduler* m_webScheduler; 53 WebScheduler* m_webScheduler;
49 }; 54 };
50 55
51 } // namespace blink 56 } // namespace blink
52 57
53 #endif // Scheduler_h 58 #endif // Scheduler_h
OLDNEW
« no previous file with comments | « no previous file | Source/platform/scheduler/Scheduler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698