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

Side by Side Diff: components/scheduler/child/child_scheduler.h

Issue 2118903002: scheduler: Move the Blink scheduler into Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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
OLDNEW
(Empty)
1 // Copyright 2015 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 COMPONENTS_SCHEDULER_CHILD_CHILD_SCHEDULER_H_
6 #define COMPONENTS_SCHEDULER_CHILD_CHILD_SCHEDULER_H_
7
8 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h"
10 #include "components/scheduler/base/task_queue.h"
11 #include "components/scheduler/child/single_thread_idle_task_runner.h"
12 #include "components/scheduler/scheduler_export.h"
13
14 namespace base {
15 class MessageLoop;
16 }
17
18 namespace scheduler {
19 class TaskQueue;
20
21 class SCHEDULER_EXPORT ChildScheduler {
22 public:
23 virtual ~ChildScheduler() {}
24
25 // Returns the default task runner.
26 virtual scoped_refptr<TaskQueue> DefaultTaskRunner() = 0;
27
28 // Returns the idle task runner. Tasks posted to this runner may be reordered
29 // relative to other task types and may be starved for an arbitrarily long
30 // time if no idle time is available.
31 virtual scoped_refptr<SingleThreadIdleTaskRunner> IdleTaskRunner() = 0;
32
33 // Returns true if there is high priority work pending on the main thread
34 // and the caller should yield to let the scheduler service that work. Note
35 // that this is a stricter condition than |IsHighPriorityWorkAnticipated|,
36 // restricted to the case where real work is pending.
37 // Must be called from the thread this scheduler was created on.
38 virtual bool ShouldYieldForHighPriorityWork() = 0;
39
40 // Returns true if a currently running idle task could exceed its deadline
41 // without impacting user experience too much. This should only be used if
42 // there is a task which cannot be pre-empted and is likely to take longer
43 // than the largest expected idle task deadline. It should NOT be polled to
44 // check whether more work can be performed on the current idle task after
45 // its deadline has expired - post a new idle task for the continuation of the
46 // work in this case.
47 // Must be called from the thread this scheduler was created on.
48 virtual bool CanExceedIdleDeadlineIfRequired() const = 0;
49
50 // Adds or removes a task observer from the scheduler. The observer will be
51 // notified before and after every executed task. These functions can only be
52 // called on the thread this scheduler was created on.
53 virtual void AddTaskObserver(
54 base::MessageLoop::TaskObserver* task_observer) = 0;
55 virtual void RemoveTaskObserver(
56 base::MessageLoop::TaskObserver* task_observer) = 0;
57
58 // Shuts down the scheduler by dropping any remaining pending work in the work
59 // queues. After this call any work posted to the task runners will be
60 // silently dropped.
61 virtual void Shutdown() = 0;
62
63 protected:
64 ChildScheduler() {}
65 DISALLOW_COPY_AND_ASSIGN(ChildScheduler);
66 };
67
68 } // namespace scheduler
69
70 #endif // COMPONENTS_SCHEDULER_CHILD_CHILD_SCHEDULER_H_
OLDNEW
« no previous file with comments | « components/scheduler/child/OWNERS ('k') | components/scheduler/child/compositor_worker_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698