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