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 "content/renderer/scheduler/single_thread_idle_task_runner.h" |
| 9 #include "content/renderer/scheduler/task_queue_manager.h" |
| 10 |
| 11 namespace cc { |
| 12 struct BeginFrameArgs; |
| 13 } |
| 14 |
| 15 namespace content { |
| 16 |
| 17 class CONTENT_EXPORT RendererScheduler { |
| 18 public: |
| 19 virtual ~RendererScheduler(); |
| 20 static scoped_ptr<RendererScheduler> Create(); |
| 21 |
| 22 // Returns the default task runner. |
| 23 virtual scoped_refptr<base::SingleThreadTaskRunner> DefaultTaskRunner() = 0; |
| 24 |
| 25 // Returns the compositor task runner. |
| 26 virtual scoped_refptr<base::SingleThreadTaskRunner> |
| 27 CompositorTaskRunner() = 0; |
| 28 |
| 29 // Returns the idle task runner. Tasks posted to this runner may be reordered |
| 30 // relative to other task types and may be starved for an arbitrarily long |
| 31 // time if no idle time is available. |
| 32 virtual scoped_refptr<SingleThreadIdleTaskRunner> IdleTaskRunner() = 0; |
| 33 |
| 34 // Called to notify about the start of a new frame. Must be called from the |
| 35 // main thread. |
| 36 virtual void WillBeginFrame(const cc::BeginFrameArgs& args) = 0; |
| 37 |
| 38 // Called to notify that a previously begun frame was committed. Must be |
| 39 // called from the main thread. |
| 40 virtual void DidCommitFrameToCompositor() = 0; |
| 41 |
| 42 // Tells the scheduler that the system received an input event. Called by the |
| 43 // compositor (impl) thread. |
| 44 virtual void DidReceiveInputEventOnCompositorThread() = 0; |
| 45 |
| 46 // Returns true if there is high priority work pending on the main thread |
| 47 // and the caller should yield to let the scheduler service that work. |
| 48 // Must be called from the main thread. |
| 49 virtual bool ShouldYieldForHighPriorityWork() = 0; |
| 50 |
| 51 // Shuts down the scheduler by dropping any remaining pending work in the work |
| 52 // queues. After this call any work posted to the task runners will be |
| 53 // silently dropped. |
| 54 virtual void Shutdown() = 0; |
| 55 |
| 56 protected: |
| 57 RendererScheduler(); |
| 58 DISALLOW_COPY_AND_ASSIGN(RendererScheduler); |
| 59 }; |
| 60 |
| 61 } // namespace content |
| 62 |
| 63 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_ |
OLD | NEW |