| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_H_ | 5 #ifndef COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_H_ |
| 6 #define COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_H_ | 6 #define COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace cc { | 25 namespace cc { |
| 26 struct BeginFrameArgs; | 26 struct BeginFrameArgs; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace blink { | 29 namespace blink { |
| 30 class WebLocalFrame; | 30 class WebLocalFrame; |
| 31 class WebThread; | 31 class WebThread; |
| 32 } | 32 } |
| 33 | 33 |
| 34 namespace v8 { |
| 35 class Isolate; |
| 36 } |
| 37 |
| 34 namespace scheduler { | 38 namespace scheduler { |
| 35 | 39 |
| 36 class RenderWidgetSchedulingState; | 40 class RenderWidgetSchedulingState; |
| 37 | 41 |
| 38 class SCHEDULER_EXPORT RendererScheduler : public ChildScheduler { | 42 class SCHEDULER_EXPORT RendererScheduler : public ChildScheduler { |
| 39 public: | 43 public: |
| 40 ~RendererScheduler() override; | 44 ~RendererScheduler() override; |
| 41 static std::unique_ptr<RendererScheduler> Create(); | 45 static std::unique_ptr<RendererScheduler> Create(); |
| 42 | 46 |
| 43 // Returns the compositor task runner. | 47 // Returns the compositor task runner. |
| 44 virtual scoped_refptr<TaskQueue> CompositorTaskRunner() = 0; | 48 virtual scoped_refptr<TaskQueue> CompositorTaskRunner() = 0; |
| 45 | 49 |
| 46 // Keep RendererScheduler::UseCaseToString in sync with this enum. | |
| 47 enum class UseCase { | |
| 48 // No active use case detected. | |
| 49 NONE, | |
| 50 // A continuous gesture (e.g., scroll, pinch) which is being driven by the | |
| 51 // compositor thread. | |
| 52 COMPOSITOR_GESTURE, | |
| 53 // An unspecified touch gesture which is being handled by the main thread. | |
| 54 // Note that since we don't have a full view of the use case, we should be | |
| 55 // careful to prioritize all work equally. | |
| 56 MAIN_THREAD_CUSTOM_INPUT_HANDLING, | |
| 57 // A continuous gesture (e.g., scroll, pinch) which is being driven by the | |
| 58 // compositor thread but also observed by the main thread. An example is | |
| 59 // synchronized scrolling where a scroll listener on the main thread changes | |
| 60 // page layout based on the current scroll position. | |
| 61 SYNCHRONIZED_GESTURE, | |
| 62 // A gesture has recently started and we are about to run main thread touch | |
| 63 // listeners to find out the actual gesture type. To minimize touch latency, | |
| 64 // only input handling work should run in this state. | |
| 65 TOUCHSTART, | |
| 66 // The page is loading. | |
| 67 LOADING, | |
| 68 // A continuous gesture (e.g., scroll) which is being handled by the main | |
| 69 // thread. | |
| 70 MAIN_THREAD_GESTURE, | |
| 71 // Must be the last entry. | |
| 72 USE_CASE_COUNT, | |
| 73 FIRST_USE_CASE = NONE, | |
| 74 }; | |
| 75 static const char* UseCaseToString(UseCase use_case); | |
| 76 | |
| 77 // Creates a WebThread implementation for the renderer main thread. | 50 // Creates a WebThread implementation for the renderer main thread. |
| 78 virtual std::unique_ptr<blink::WebThread> CreateMainThread() = 0; | 51 virtual std::unique_ptr<blink::WebThread> CreateMainThread() = 0; |
| 79 | 52 |
| 80 // Returns the loading task runner. This queue is intended for tasks related | 53 // Returns the loading task runner. This queue is intended for tasks related |
| 81 // to resource dispatch, foreground HTML parsing, etc... | 54 // to resource dispatch, foreground HTML parsing, etc... |
| 82 virtual scoped_refptr<TaskQueue> LoadingTaskRunner() = 0; | 55 virtual scoped_refptr<TaskQueue> LoadingTaskRunner() = 0; |
| 83 | 56 |
| 84 // Returns the timer task runner. This queue is intended for DOM Timers. | 57 // Returns the timer task runner. This queue is intended for DOM Timers. |
| 85 // TODO(alexclarke): Get rid of this default timer queue. | 58 // TODO(alexclarke): Get rid of this default timer queue. |
| 86 virtual scoped_refptr<TaskQueue> TimerTaskRunner() = 0; | 59 virtual scoped_refptr<TaskQueue> TimerTaskRunner() = 0; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 157 |
| 185 // Sets whether to allow suspension of timers after the backgrounded signal is | 158 // Sets whether to allow suspension of timers after the backgrounded signal is |
| 186 // received via OnRendererBackgrounded. Defaults to disabled. | 159 // received via OnRendererBackgrounded. Defaults to disabled. |
| 187 virtual void SetTimerQueueSuspensionWhenBackgroundedEnabled(bool enabled) = 0; | 160 virtual void SetTimerQueueSuspensionWhenBackgroundedEnabled(bool enabled) = 0; |
| 188 | 161 |
| 189 // Sets the default blame context to which top level work should be | 162 // Sets the default blame context to which top level work should be |
| 190 // attributed in this renderer. |blame_context| must outlive this scheduler. | 163 // attributed in this renderer. |blame_context| must outlive this scheduler. |
| 191 virtual void SetTopLevelBlameContext( | 164 virtual void SetTopLevelBlameContext( |
| 192 base::trace_event::BlameContext* blame_context) = 0; | 165 base::trace_event::BlameContext* blame_context) = 0; |
| 193 | 166 |
| 167 // Set the main thread's V8 isolate. Used for controlling v8's RAIL mode. |
| 168 virtual void SetMainThreadIsolate(v8::Isolate* isolate) = 0; |
| 169 |
| 194 protected: | 170 protected: |
| 195 RendererScheduler(); | 171 RendererScheduler(); |
| 196 DISALLOW_COPY_AND_ASSIGN(RendererScheduler); | 172 DISALLOW_COPY_AND_ASSIGN(RendererScheduler); |
| 197 }; | 173 }; |
| 198 | 174 |
| 199 } // namespace scheduler | 175 } // namespace scheduler |
| 200 | 176 |
| 201 #endif // COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_H_ | 177 #endif // COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_H_ |
| OLD | NEW |