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

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: DCHECK tweak. Created 5 years, 10 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 | « no previous file | content/renderer/scheduler/renderer_scheduler_impl.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 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/cancelable_closure_holder.h" 12 #include "content/renderer/scheduler/cancelable_closure_holder.h"
12 #include "content/renderer/scheduler/renderer_scheduler.h" 13 #include "content/renderer/scheduler/renderer_scheduler.h"
13 #include "content/renderer/scheduler/single_thread_idle_task_runner.h" 14 #include "content/renderer/scheduler/single_thread_idle_task_runner.h"
14 #include "content/renderer/scheduler/task_queue_manager.h" 15 #include "content/renderer/scheduler/task_queue_manager.h"
15 16
16 namespace base { 17 namespace base {
17 namespace debug { 18 namespace debug {
18 class ConvertableToTraceFormat; 19 class ConvertableToTraceFormat;
19 } 20 }
20 } 21 }
(...skipping 14 matching lines...) Expand all
35 scoped_refptr<SingleThreadIdleTaskRunner> IdleTaskRunner() override; 36 scoped_refptr<SingleThreadIdleTaskRunner> IdleTaskRunner() override;
36 scoped_refptr<base::SingleThreadTaskRunner> LoadingTaskRunner() override; 37 scoped_refptr<base::SingleThreadTaskRunner> LoadingTaskRunner() override;
37 void WillBeginFrame(const cc::BeginFrameArgs& args) override; 38 void WillBeginFrame(const cc::BeginFrameArgs& args) override;
38 void DidCommitFrameToCompositor() override; 39 void DidCommitFrameToCompositor() override;
39 void DidReceiveInputEventOnCompositorThread( 40 void DidReceiveInputEventOnCompositorThread(
40 blink::WebInputEvent::Type type) override; 41 blink::WebInputEvent::Type type) override;
41 void DidAnimateForInputOnCompositorThread() override; 42 void DidAnimateForInputOnCompositorThread() override;
42 bool ShouldYieldForHighPriorityWork() override; 43 bool ShouldYieldForHighPriorityWork() override;
43 void Shutdown() override; 44 void Shutdown() override;
44 45
45 protected: 46 void SetTimeSourceForTesting(scoped_refptr<cc::TestNowSource> time_source);
46 // Virtual for testing.
47 virtual base::TimeTicks Now() const;
48 47
49 private: 48 private:
50 friend class RendererSchedulerImplTest; 49 friend class RendererSchedulerImplTest;
51 50
52 // Keep RendererSchedulerImpl::TaskQueueIdToString in sync with this enum. 51 // Keep RendererSchedulerImpl::TaskQueueIdToString in sync with this enum.
53 enum QueueId { 52 enum QueueId {
54 DEFAULT_TASK_QUEUE, 53 DEFAULT_TASK_QUEUE,
55 COMPOSITOR_TASK_QUEUE, 54 COMPOSITOR_TASK_QUEUE,
56 IDLE_TASK_QUEUE, 55 IDLE_TASK_QUEUE,
57 CONTROL_TASK_QUEUE, 56 CONTROL_TASK_QUEUE,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // Updates the scheduler policy. Must be called from the main thread. 108 // Updates the scheduler policy. Must be called from the main thread.
110 void UpdatePolicy(); 109 void UpdatePolicy();
111 110
112 // An input event of some sort happened, the policy may need updating. 111 // An input event of some sort happened, the policy may need updating.
113 void UpdateForInputEvent(); 112 void UpdateForInputEvent();
114 113
115 // Start and end an idle period. 114 // Start and end an idle period.
116 void StartIdlePeriod(); 115 void StartIdlePeriod();
117 void EndIdlePeriod(); 116 void EndIdlePeriod();
118 117
118 base::TimeTicks Now() const;
119
119 base::ThreadChecker main_thread_checker_; 120 base::ThreadChecker main_thread_checker_;
120 scoped_ptr<RendererTaskQueueSelector> renderer_task_queue_selector_; 121 scoped_ptr<RendererTaskQueueSelector> renderer_task_queue_selector_;
121 scoped_ptr<TaskQueueManager> task_queue_manager_; 122 scoped_ptr<TaskQueueManager> task_queue_manager_;
122 scoped_refptr<base::SingleThreadTaskRunner> control_task_runner_; 123 scoped_refptr<base::SingleThreadTaskRunner> control_task_runner_;
123 scoped_refptr<base::SingleThreadTaskRunner> default_task_runner_; 124 scoped_refptr<base::SingleThreadTaskRunner> default_task_runner_;
124 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; 125 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
125 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner_; 126 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner_;
126 scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner_; 127 scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner_;
127 128
128 base::Closure update_policy_closure_; 129 base::Closure update_policy_closure_;
129 CancelableClosureHolder end_idle_period_closure_; 130 CancelableClosureHolder end_idle_period_closure_;
130 131
131 // Don't access current_policy_ directly, instead use SchedulerPolicy(). 132 // Don't access current_policy_ directly, instead use SchedulerPolicy().
132 Policy current_policy_; 133 Policy current_policy_;
133 134
134 base::TimeTicks estimated_next_frame_begin_; 135 base::TimeTicks estimated_next_frame_begin_;
135 136
136 // The incoming_signals_lock_ mutex protects access to last_input_time_ 137 // The incoming_signals_lock_ mutex protects access to last_input_time_
137 // and write access to policy_may_need_update_. 138 // and write access to policy_may_need_update_.
138 base::Lock incoming_signals_lock_; 139 base::Lock incoming_signals_lock_;
139 base::TimeTicks last_input_time_; 140 base::TimeTicks last_input_time_;
140 PollableNeedsUpdateFlag policy_may_need_update_; 141 PollableNeedsUpdateFlag policy_may_need_update_;
141 142
143 scoped_refptr<cc::TestNowSource> time_source_;
144
142 base::WeakPtr<RendererSchedulerImpl> weak_renderer_scheduler_ptr_; 145 base::WeakPtr<RendererSchedulerImpl> weak_renderer_scheduler_ptr_;
143 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; 146 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_;
144 147
145 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); 148 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl);
146 }; 149 };
147 150
148 } // namespace content 151 } // namespace content
149 152
150 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ 153 #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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698