ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / content / renderer / scheduler / renderer_scheduler.h
blob7d2c39e3a86d5379382a8bf6929026343eee5bb4
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_
6 #define CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_
8 #include "content/renderer/scheduler/single_thread_idle_task_runner.h"
9 #include "content/renderer/scheduler/task_queue_manager.h"
10 #include "third_party/WebKit/public/web/WebInputEvent.h"
12 namespace cc {
13 struct BeginFrameArgs;
16 namespace content {
18 class CONTENT_EXPORT RendererScheduler {
19 public:
20 virtual ~RendererScheduler();
21 static scoped_ptr<RendererScheduler> Create();
23 // Returns the default task runner.
24 virtual scoped_refptr<base::SingleThreadTaskRunner> DefaultTaskRunner() = 0;
26 // Returns the compositor task runner.
27 virtual scoped_refptr<base::SingleThreadTaskRunner>
28 CompositorTaskRunner() = 0;
30 // Returns the idle task runner. Tasks posted to this runner may be reordered
31 // relative to other task types and may be starved for an arbitrarily long
32 // time if no idle time is available.
33 virtual scoped_refptr<SingleThreadIdleTaskRunner> IdleTaskRunner() = 0;
35 // Returns the loading task runner. This queue is intended for tasks related
36 // to resource dispatch, foreground HTML parsing, etc...
37 virtual scoped_refptr<base::SingleThreadTaskRunner> LoadingTaskRunner() = 0;
39 // Called to notify about the start of an extended period where no frames
40 // need to be drawn. Must be called from the main thread.
41 virtual void BeginFrameNotExpectedSoon() = 0;
43 // Called to notify about the start of a new frame. Must be called from the
44 // main thread.
45 virtual void WillBeginFrame(const cc::BeginFrameArgs& args) = 0;
47 // Called to notify that a previously begun frame was committed. Must be
48 // called from the main thread.
49 virtual void DidCommitFrameToCompositor() = 0;
51 // Tells the scheduler that the system received an input event. Called by the
52 // compositor (impl) thread.
53 virtual void DidReceiveInputEventOnCompositorThread(
54 const blink::WebInputEvent& web_input_event) = 0;
56 // Tells the scheduler that the system is displaying an input animation (e.g.
57 // a fling). Called by the compositor (impl) thread.
58 virtual void DidAnimateForInputOnCompositorThread() = 0;
60 // Returns true if the scheduler has reason to believe that high priority work
61 // may soon arrive on the main thread, e.g., if gesture events were observed
62 // recently.
63 // Must be called from the main thread.
64 virtual bool IsHighPriorityWorkAnticipated() = 0;
66 // Returns true if there is high priority work pending on the main thread
67 // and the caller should yield to let the scheduler service that work. Note
68 // that this is a stricter condition than |IsHighPriorityWorkAnticipated|,
69 // restricted to the case where real work is pending.
70 // Must be called from the main thread.
71 virtual bool ShouldYieldForHighPriorityWork() = 0;
73 // Adds or removes a task observer from the scheduler. The observer will be
74 // notified before and after every executed task. These functions can only be
75 // called on the main thread.
76 virtual void AddTaskObserver(
77 base::MessageLoop::TaskObserver* task_observer) = 0;
78 virtual void RemoveTaskObserver(
79 base::MessageLoop::TaskObserver* task_observer) = 0;
81 // Shuts down the scheduler by dropping any remaining pending work in the work
82 // queues. After this call any work posted to the task runners will be
83 // silently dropped.
84 virtual void Shutdown() = 0;
86 protected:
87 RendererScheduler();
88 DISALLOW_COPY_AND_ASSIGN(RendererScheduler);
91 } // namespace content
93 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_