Don't send a SHChangeNotify for creating an app icon when creating a shortcut.
[chromium-blink-merge.git] / content / renderer / scheduler / renderer_scheduler.h
blob7167f9585e614d87d4a6c360def3cedba1f8f766
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 // Returns true if a currently running idle task could exceed its deadline
74 // without impacting user experience too much. This should only be used if
75 // there is a task which cannot be pre-empted and is likely to take longer
76 // than the largest expected idle task deadline. It should NOT be polled to
77 // check whether more work can be performed on the current idle task after
78 // its deadline has expired - post a new idle task for the continuation of the
79 // work in this case.
80 // Must be called from the main thread.
81 virtual bool CanExceedIdleDeadlineIfRequired() const = 0;
83 // Adds or removes a task observer from the scheduler. The observer will be
84 // notified before and after every executed task. These functions can only be
85 // called on the main thread.
86 virtual void AddTaskObserver(
87 base::MessageLoop::TaskObserver* task_observer) = 0;
88 virtual void RemoveTaskObserver(
89 base::MessageLoop::TaskObserver* task_observer) = 0;
91 // Shuts down the scheduler by dropping any remaining pending work in the work
92 // queues. After this call any work posted to the task runners will be
93 // silently dropped.
94 virtual void Shutdown() = 0;
96 protected:
97 RendererScheduler();
98 DISALLOW_COPY_AND_ASSIGN(RendererScheduler);
101 } // namespace content
103 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_