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

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

Issue 845543004: Run task queue manager work in batches (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Header cleanup. Created 5 years, 11 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
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_IMPL_H_ 5 #ifndef CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_
6 #define CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ 6 #define CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_
7 7
8 #include "base/atomicops.h" 8 #include "base/atomicops.h"
9 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "base/threading/thread_checker.h" 10 #include "base/threading/thread_checker.h"
11 #include "cc/test/test_now_source.h"
11 #include "content/renderer/scheduler/renderer_scheduler.h" 12 #include "content/renderer/scheduler/renderer_scheduler.h"
12 #include "content/renderer/scheduler/single_thread_idle_task_runner.h" 13 #include "content/renderer/scheduler/single_thread_idle_task_runner.h"
13 #include "content/renderer/scheduler/task_queue_manager.h" 14 #include "content/renderer/scheduler/task_queue_manager.h"
14 15
15 namespace base { 16 namespace base {
16 namespace debug { 17 namespace debug {
17 class ConvertableToTraceFormat; 18 class ConvertableToTraceFormat;
18 } 19 }
19 } 20 }
20 21
(...skipping 12 matching lines...) Expand all
33 scoped_refptr<base::SingleThreadTaskRunner> CompositorTaskRunner() override; 34 scoped_refptr<base::SingleThreadTaskRunner> CompositorTaskRunner() override;
34 scoped_refptr<SingleThreadIdleTaskRunner> IdleTaskRunner() override; 35 scoped_refptr<SingleThreadIdleTaskRunner> IdleTaskRunner() override;
35 void WillBeginFrame(const cc::BeginFrameArgs& args) override; 36 void WillBeginFrame(const cc::BeginFrameArgs& args) override;
36 void DidCommitFrameToCompositor() override; 37 void DidCommitFrameToCompositor() override;
37 void DidReceiveInputEventOnCompositorThread( 38 void DidReceiveInputEventOnCompositorThread(
38 blink::WebInputEvent::Type type) override; 39 blink::WebInputEvent::Type type) override;
39 void DidAnimateForInputOnCompositorThread() override; 40 void DidAnimateForInputOnCompositorThread() override;
40 bool ShouldYieldForHighPriorityWork() override; 41 bool ShouldYieldForHighPriorityWork() override;
41 void Shutdown() override; 42 void Shutdown() override;
42 43
43 protected: 44 void SetTimeSourceForTesting(scoped_refptr<cc::TestNowSource> time_source);
44 // Virtual for testing.
45 virtual base::TimeTicks Now() const;
46 45
47 private: 46 private:
48 friend class RendererSchedulerImplTest; 47 friend class RendererSchedulerImplTest;
49 48
50 enum QueueId { 49 enum QueueId {
51 DEFAULT_TASK_QUEUE, 50 DEFAULT_TASK_QUEUE,
52 COMPOSITOR_TASK_QUEUE, 51 COMPOSITOR_TASK_QUEUE,
53 IDLE_TASK_QUEUE, 52 IDLE_TASK_QUEUE,
54 CONTROL_TASK_QUEUE, 53 CONTROL_TASK_QUEUE,
55 // Must be the last entry. 54 // Must be the last entry.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // Updates the scheduler policy. Must be called from the main thread. 104 // Updates the scheduler policy. Must be called from the main thread.
106 void UpdatePolicy(); 105 void UpdatePolicy();
107 106
108 // An input event of some sort happened, the policy may need updating. 107 // An input event of some sort happened, the policy may need updating.
109 void UpdateForInputEvent(); 108 void UpdateForInputEvent();
110 109
111 // Start and end an idle period. 110 // Start and end an idle period.
112 void StartIdlePeriod(); 111 void StartIdlePeriod();
113 void EndIdlePeriod(); 112 void EndIdlePeriod();
114 113
114 base::TimeTicks Now() const;
115
115 base::ThreadChecker main_thread_checker_; 116 base::ThreadChecker main_thread_checker_;
116 scoped_ptr<RendererTaskQueueSelector> renderer_task_queue_selector_; 117 scoped_ptr<RendererTaskQueueSelector> renderer_task_queue_selector_;
117 scoped_ptr<TaskQueueManager> task_queue_manager_; 118 scoped_ptr<TaskQueueManager> task_queue_manager_;
118 scoped_refptr<base::SingleThreadTaskRunner> control_task_runner_; 119 scoped_refptr<base::SingleThreadTaskRunner> control_task_runner_;
119 scoped_refptr<base::SingleThreadTaskRunner> default_task_runner_; 120 scoped_refptr<base::SingleThreadTaskRunner> default_task_runner_;
120 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; 121 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
121 scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner_; 122 scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner_;
122 123
123 base::Closure update_policy_closure_; 124 base::Closure update_policy_closure_;
124 base::Closure end_idle_period_closure_; 125 base::Closure end_idle_period_closure_;
125 126
126 // Don't access current_policy_ directly, instead use SchedulerPolicy(). 127 // Don't access current_policy_ directly, instead use SchedulerPolicy().
127 Policy current_policy_; 128 Policy current_policy_;
128 129
129 base::TimeTicks estimated_next_frame_begin_; 130 base::TimeTicks estimated_next_frame_begin_;
130 131
131 // The incoming_signals_lock_ mutex protects access to last_input_time_ 132 // The incoming_signals_lock_ mutex protects access to last_input_time_
132 // and write access to policy_may_need_update_. 133 // and write access to policy_may_need_update_.
133 base::Lock incoming_signals_lock_; 134 base::Lock incoming_signals_lock_;
134 base::TimeTicks last_input_time_; 135 base::TimeTicks last_input_time_;
135 PollableNeedsUpdateFlag policy_may_need_update_; 136 PollableNeedsUpdateFlag policy_may_need_update_;
136 137
138 scoped_refptr<cc::TestNowSource> time_source_;
139
137 base::WeakPtr<RendererSchedulerImpl> weak_renderer_scheduler_ptr_; 140 base::WeakPtr<RendererSchedulerImpl> weak_renderer_scheduler_ptr_;
138 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; 141 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_;
139 142
140 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); 143 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl);
141 }; 144 };
142 145
143 } // namespace content 146 } // namespace content
144 147
145 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ 148 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/scheduler/renderer_scheduler_impl.cc » ('j') | content/renderer/scheduler/task_queue_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698