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

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

Issue 1089833002: Introduce ChildScheduler as common base interface for WorkerScheduler and RendererScheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits Created 5 years, 8 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 | « content/content_child.gypi ('k') | no next file » | 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 CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_ 5 #ifndef CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_
6 #define CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_ 6 #define CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_
7 7
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "content/child/scheduler/child_scheduler.h"
9 #include "content/child/scheduler/single_thread_idle_task_runner.h" 10 #include "content/child/scheduler/single_thread_idle_task_runner.h"
10 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
11 #include "third_party/WebKit/public/web/WebInputEvent.h" 12 #include "third_party/WebKit/public/web/WebInputEvent.h"
12 13
13 namespace cc { 14 namespace cc {
14 struct BeginFrameArgs; 15 struct BeginFrameArgs;
15 } 16 }
16 17
17 namespace content { 18 namespace content {
18 19
19 class CONTENT_EXPORT RendererScheduler { 20 class CONTENT_EXPORT RendererScheduler : public ChildScheduler {
20 public: 21 public:
21 virtual ~RendererScheduler(); 22 ~RendererScheduler() override;
22 static scoped_ptr<RendererScheduler> Create(); 23 static scoped_ptr<RendererScheduler> Create();
23 24
24 // Returns the default task runner.
25 virtual scoped_refptr<base::SingleThreadTaskRunner> DefaultTaskRunner() = 0;
26
27 // Returns the compositor task runner. 25 // Returns the compositor task runner.
28 virtual scoped_refptr<base::SingleThreadTaskRunner> 26 virtual scoped_refptr<base::SingleThreadTaskRunner>
29 CompositorTaskRunner() = 0; 27 CompositorTaskRunner() = 0;
30 28
31 // Returns the idle task runner. Tasks posted to this runner may be reordered
32 // relative to other task types and may be starved for an arbitrarily long
33 // time if no idle time is available.
34 virtual scoped_refptr<SingleThreadIdleTaskRunner> IdleTaskRunner() = 0;
35
36 // Returns the loading task runner. This queue is intended for tasks related 29 // Returns the loading task runner. This queue is intended for tasks related
37 // to resource dispatch, foreground HTML parsing, etc... 30 // to resource dispatch, foreground HTML parsing, etc...
38 virtual scoped_refptr<base::SingleThreadTaskRunner> LoadingTaskRunner() = 0; 31 virtual scoped_refptr<base::SingleThreadTaskRunner> LoadingTaskRunner() = 0;
39 32
40 // Returns the timer task runner. This queue is intended for DOM Timers. 33 // Returns the timer task runner. This queue is intended for DOM Timers.
41 virtual scoped_refptr<base::SingleThreadTaskRunner> TimerTaskRunner() = 0; 34 virtual scoped_refptr<base::SingleThreadTaskRunner> TimerTaskRunner() = 0;
42 35
43 // Called to notify about the start of an extended period where no frames 36 // Called to notify about the start of an extended period where no frames
44 // need to be drawn. Must be called from the main thread. 37 // need to be drawn. Must be called from the main thread.
45 virtual void BeginFrameNotExpectedSoon() = 0; 38 virtual void BeginFrameNotExpectedSoon() = 0;
(...skipping 25 matching lines...) Expand all
71 // The renderer is assumed to be visible when the scheduler is constructed. 64 // The renderer is assumed to be visible when the scheduler is constructed.
72 // Must be called on the main thread. 65 // Must be called on the main thread.
73 virtual void OnRendererVisible() = 0; 66 virtual void OnRendererVisible() = 0;
74 67
75 // Returns true if the scheduler has reason to believe that high priority work 68 // Returns true if the scheduler has reason to believe that high priority work
76 // may soon arrive on the main thread, e.g., if gesture events were observed 69 // may soon arrive on the main thread, e.g., if gesture events were observed
77 // recently. 70 // recently.
78 // Must be called from the main thread. 71 // Must be called from the main thread.
79 virtual bool IsHighPriorityWorkAnticipated() = 0; 72 virtual bool IsHighPriorityWorkAnticipated() = 0;
80 73
81 // Returns true if there is high priority work pending on the main thread
82 // and the caller should yield to let the scheduler service that work. Note
83 // that this is a stricter condition than |IsHighPriorityWorkAnticipated|,
84 // restricted to the case where real work is pending.
85 // Must be called from the main thread.
86 virtual bool ShouldYieldForHighPriorityWork() = 0;
87
88 // Returns true if a currently running idle task could exceed its deadline
89 // without impacting user experience too much. This should only be used if
90 // there is a task which cannot be pre-empted and is likely to take longer
91 // than the largest expected idle task deadline. It should NOT be polled to
92 // check whether more work can be performed on the current idle task after
93 // its deadline has expired - post a new idle task for the continuation of the
94 // work in this case.
95 // Must be called from the main thread.
96 virtual bool CanExceedIdleDeadlineIfRequired() const = 0;
97
98 // Adds or removes a task observer from the scheduler. The observer will be
99 // notified before and after every executed task. These functions can only be
100 // called on the main thread.
101 virtual void AddTaskObserver(
102 base::MessageLoop::TaskObserver* task_observer) = 0;
103 virtual void RemoveTaskObserver(
104 base::MessageLoop::TaskObserver* task_observer) = 0;
105
106 // Shuts down the scheduler by dropping any remaining pending work in the work
107 // queues. After this call any work posted to the task runners will be
108 // silently dropped.
109 virtual void Shutdown() = 0;
110
111 // Suspends the timer queue and increments the timer queue suspension count. 74 // Suspends the timer queue and increments the timer queue suspension count.
112 // May only be called from the main thread. 75 // May only be called from the main thread.
113 virtual void SuspendTimerQueue() = 0; 76 virtual void SuspendTimerQueue() = 0;
114 77
115 // Decrements the timer queue suspension count and re-enables the timer queue 78 // Decrements the timer queue suspension count and re-enables the timer queue
116 // if the suspension count is zero and the current schduler policy allows it. 79 // if the suspension count is zero and the current schduler policy allows it.
117 virtual void ResumeTimerQueue() = 0; 80 virtual void ResumeTimerQueue() = 0;
118 81
119 protected: 82 protected:
120 RendererScheduler(); 83 RendererScheduler();
121 DISALLOW_COPY_AND_ASSIGN(RendererScheduler); 84 DISALLOW_COPY_AND_ASSIGN(RendererScheduler);
122 }; 85 };
123 86
124 } // namespace content 87 } // namespace content
125 88
126 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_ 89 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_
OLDNEW
« no previous file with comments | « content/content_child.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698