| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_ | |
| 6 #define CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_ | |
| 7 | |
| 8 #include "base/message_loop/message_loop.h" | |
| 9 #include "content/child/scheduler/child_scheduler.h" | |
| 10 #include "content/child/scheduler/single_thread_idle_task_runner.h" | |
| 11 #include "content/common/content_export.h" | |
| 12 #include "third_party/WebKit/public/web/WebInputEvent.h" | |
| 13 | |
| 14 namespace cc { | |
| 15 struct BeginFrameArgs; | |
| 16 } | |
| 17 | |
| 18 namespace content { | |
| 19 | |
| 20 class CONTENT_EXPORT RendererScheduler : public ChildScheduler { | |
| 21 public: | |
| 22 ~RendererScheduler() override; | |
| 23 static scoped_ptr<RendererScheduler> Create(); | |
| 24 | |
| 25 // Returns the compositor task runner. | |
| 26 virtual scoped_refptr<base::SingleThreadTaskRunner> | |
| 27 CompositorTaskRunner() = 0; | |
| 28 | |
| 29 // Returns the loading task runner. This queue is intended for tasks related | |
| 30 // to resource dispatch, foreground HTML parsing, etc... | |
| 31 virtual scoped_refptr<base::SingleThreadTaskRunner> LoadingTaskRunner() = 0; | |
| 32 | |
| 33 // Returns the timer task runner. This queue is intended for DOM Timers. | |
| 34 virtual scoped_refptr<base::SingleThreadTaskRunner> TimerTaskRunner() = 0; | |
| 35 | |
| 36 // Called to notify about the start of an extended period where no frames | |
| 37 // need to be drawn. Must be called from the main thread. | |
| 38 virtual void BeginFrameNotExpectedSoon() = 0; | |
| 39 | |
| 40 // Called to notify about the start of a new frame. Must be called from the | |
| 41 // main thread. | |
| 42 virtual void WillBeginFrame(const cc::BeginFrameArgs& args) = 0; | |
| 43 | |
| 44 // Called to notify that a previously begun frame was committed. Must be | |
| 45 // called from the main thread. | |
| 46 virtual void DidCommitFrameToCompositor() = 0; | |
| 47 | |
| 48 // Tells the scheduler that the system received an input event. Called by the | |
| 49 // compositor (impl) thread. | |
| 50 virtual void DidReceiveInputEventOnCompositorThread( | |
| 51 const blink::WebInputEvent& web_input_event) = 0; | |
| 52 | |
| 53 // Tells the scheduler that the system is displaying an input animation (e.g. | |
| 54 // a fling). Called by the compositor (impl) thread. | |
| 55 virtual void DidAnimateForInputOnCompositorThread() = 0; | |
| 56 | |
| 57 // Tells the scheduler that all render widgets managed by this renderer | |
| 58 // process have been hidden. The renderer is assumed to be visible when the | |
| 59 // scheduler is constructed. Must be called on the main thread. | |
| 60 virtual void OnRendererHidden() = 0; | |
| 61 | |
| 62 // Tells the scheduler that at least one render widget managed by this | |
| 63 // renderer process has become visible and the renderer is no longer hidden. | |
| 64 // The renderer is assumed to be visible when the scheduler is constructed. | |
| 65 // Must be called on the main thread. | |
| 66 virtual void OnRendererVisible() = 0; | |
| 67 | |
| 68 // Returns true if the scheduler has reason to believe that high priority work | |
| 69 // may soon arrive on the main thread, e.g., if gesture events were observed | |
| 70 // recently. | |
| 71 // Must be called from the main thread. | |
| 72 virtual bool IsHighPriorityWorkAnticipated() = 0; | |
| 73 | |
| 74 // Suspends the timer queue and increments the timer queue suspension count. | |
| 75 // May only be called from the main thread. | |
| 76 virtual void SuspendTimerQueue() = 0; | |
| 77 | |
| 78 // Decrements the timer queue suspension count and re-enables the timer queue | |
| 79 // if the suspension count is zero and the current schduler policy allows it. | |
| 80 virtual void ResumeTimerQueue() = 0; | |
| 81 | |
| 82 protected: | |
| 83 RendererScheduler(); | |
| 84 DISALLOW_COPY_AND_ASSIGN(RendererScheduler); | |
| 85 }; | |
| 86 | |
| 87 } // namespace content | |
| 88 | |
| 89 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_ | |
| OLD | NEW |