Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: components/scheduler/renderer/renderer_scheduler.h

Issue 2093983002: scheduler: Tell v8 about the current RAIL mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing gyp dependencies Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/scheduler/renderer/DEPS ('k') | components/scheduler/renderer/renderer_scheduler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "components/scheduler/child/child_scheduler.h" 12 #include "components/scheduler/child/child_scheduler.h"
13 #include "components/scheduler/child/single_thread_idle_task_runner.h" 13 #include "components/scheduler/child/single_thread_idle_task_runner.h"
14 #include "components/scheduler/renderer/render_widget_scheduling_state.h" 14 #include "components/scheduler/renderer/render_widget_scheduling_state.h"
15 #include "components/scheduler/scheduler_export.h" 15 #include "components/scheduler/scheduler_export.h"
16 #include "third_party/WebKit/public/platform/WebScheduler.h" 16 #include "third_party/WebKit/public/platform/WebScheduler.h"
17 #include "third_party/WebKit/public/web/WebInputEvent.h" 17 #include "third_party/WebKit/public/web/WebInputEvent.h"
18 #include "v8/include/v8.h"
18 19
19 namespace base { 20 namespace base {
20 namespace trace_event { 21 namespace trace_event {
21 class BlameContext; 22 class BlameContext;
22 } 23 }
23 } 24 }
24 25
25 namespace cc { 26 namespace cc {
26 struct BeginFrameArgs; 27 struct BeginFrameArgs;
27 } 28 }
28 29
29 namespace blink { 30 namespace blink {
30 class WebLocalFrame; 31 class WebLocalFrame;
31 class WebThread; 32 class WebThread;
32 } 33 }
33 34
34 namespace scheduler { 35 namespace scheduler {
35 36
36 class RenderWidgetSchedulingState; 37 class RenderWidgetSchedulingState;
37 38
38 class SCHEDULER_EXPORT RendererScheduler : public ChildScheduler { 39 class SCHEDULER_EXPORT RendererScheduler : public ChildScheduler {
39 public: 40 public:
41 class SCHEDULER_EXPORT RAILModeObserver {
42 public:
43 virtual ~RAILModeObserver();
44 virtual void OnRAILModeChanged(v8::RAILMode rail_mode) = 0;
45 };
46
40 ~RendererScheduler() override; 47 ~RendererScheduler() override;
41 static std::unique_ptr<RendererScheduler> Create(); 48 static std::unique_ptr<RendererScheduler> Create();
42 49
43 // Returns the compositor task runner. 50 // Returns the compositor task runner.
44 virtual scoped_refptr<TaskQueue> CompositorTaskRunner() = 0; 51 virtual scoped_refptr<TaskQueue> CompositorTaskRunner() = 0;
45 52
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. 53 // Creates a WebThread implementation for the renderer main thread.
78 virtual std::unique_ptr<blink::WebThread> CreateMainThread() = 0; 54 virtual std::unique_ptr<blink::WebThread> CreateMainThread() = 0;
79 55
80 // Returns the loading task runner. This queue is intended for tasks related 56 // Returns the loading task runner. This queue is intended for tasks related
81 // to resource dispatch, foreground HTML parsing, etc... 57 // to resource dispatch, foreground HTML parsing, etc...
82 virtual scoped_refptr<TaskQueue> LoadingTaskRunner() = 0; 58 virtual scoped_refptr<TaskQueue> LoadingTaskRunner() = 0;
83 59
84 // Returns the timer task runner. This queue is intended for DOM Timers. 60 // Returns the timer task runner. This queue is intended for DOM Timers.
85 // TODO(alexclarke): Get rid of this default timer queue. 61 // TODO(alexclarke): Get rid of this default timer queue.
86 virtual scoped_refptr<TaskQueue> TimerTaskRunner() = 0; 62 virtual scoped_refptr<TaskQueue> TimerTaskRunner() = 0;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 160
185 // Sets whether to allow suspension of timers after the backgrounded signal is 161 // Sets whether to allow suspension of timers after the backgrounded signal is
186 // received via OnRendererBackgrounded. Defaults to disabled. 162 // received via OnRendererBackgrounded. Defaults to disabled.
187 virtual void SetTimerQueueSuspensionWhenBackgroundedEnabled(bool enabled) = 0; 163 virtual void SetTimerQueueSuspensionWhenBackgroundedEnabled(bool enabled) = 0;
188 164
189 // Sets the default blame context to which top level work should be 165 // Sets the default blame context to which top level work should be
190 // attributed in this renderer. |blame_context| must outlive this scheduler. 166 // attributed in this renderer. |blame_context| must outlive this scheduler.
191 virtual void SetTopLevelBlameContext( 167 virtual void SetTopLevelBlameContext(
192 base::trace_event::BlameContext* blame_context) = 0; 168 base::trace_event::BlameContext* blame_context) = 0;
193 169
170 // The renderer scheduler maintains an estimated RAIL mode[1]. This observer
171 // can be used to get notified when the mode changes. The observer will be
172 // called on the main thread and must outlive this class.
173 // [1]
174 // https://developers.google.com/web/tools/chrome-devtools/profile/evaluate-pe rformance/rail
175 virtual void SetRAILModeObserver(RAILModeObserver* observer) = 0;
176
194 protected: 177 protected:
195 RendererScheduler(); 178 RendererScheduler();
196 DISALLOW_COPY_AND_ASSIGN(RendererScheduler); 179 DISALLOW_COPY_AND_ASSIGN(RendererScheduler);
197 }; 180 };
198 181
199 } // namespace scheduler 182 } // namespace scheduler
200 183
201 #endif // COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_H_ 184 #endif // COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_H_
OLDNEW
« no previous file with comments | « components/scheduler/renderer/DEPS ('k') | components/scheduler/renderer/renderer_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698