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

Side by Side Diff: cc/test/scheduler_test_common.h

Issue 2158023005: cc: Remove retro frame logic from scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 CC_TEST_SCHEDULER_TEST_COMMON_H_ 5 #ifndef CC_TEST_SCHEDULER_TEST_COMMON_H_
6 #define CC_TEST_SCHEDULER_TEST_COMMON_H_ 6 #define CC_TEST_SCHEDULER_TEST_COMMON_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 TestScheduler( 123 TestScheduler(
124 base::SimpleTestTickClock* now_src, 124 base::SimpleTestTickClock* now_src,
125 SchedulerClient* client, 125 SchedulerClient* client,
126 const SchedulerSettings& scheduler_settings, 126 const SchedulerSettings& scheduler_settings,
127 int layer_tree_host_id, 127 int layer_tree_host_id,
128 OrderedSimpleTaskRunner* task_runner, 128 OrderedSimpleTaskRunner* task_runner,
129 BeginFrameSource* begin_frame_source, 129 BeginFrameSource* begin_frame_source,
130 std::unique_ptr<CompositorTimingHistory> compositor_timing_history); 130 std::unique_ptr<CompositorTimingHistory> compositor_timing_history);
131 131
132 // Extra test helper functionality 132 // Extra test helper functionality
133 bool IsBeginRetroFrameArgsEmpty() const {
134 return begin_retro_frame_args_.empty();
135 }
136
137 bool SwapThrottled() const { return state_machine_.SwapThrottled(); } 133 bool SwapThrottled() const { return state_machine_.SwapThrottled(); }
138 134
139 bool NeedsBeginMainFrame() const { 135 bool NeedsBeginMainFrame() const {
140 return state_machine_.needs_begin_main_frame(); 136 return state_machine_.needs_begin_main_frame();
141 } 137 }
142 138
143 BeginFrameSource& frame_source() { return *begin_frame_source_; } 139 BeginFrameSource& frame_source() { return *begin_frame_source_; }
144 140
145 bool MainThreadMissedLastDeadline() const { 141 bool MainThreadMissedLastDeadline() const {
146 return state_machine_.main_thread_missed_last_deadline(); 142 return state_machine_.main_thread_missed_last_deadline();
147 } 143 }
148 144
149 bool begin_frames_expected() const { 145 bool begin_frames_expected() const {
150 return begin_frame_source_ && observing_begin_frame_source_; 146 return begin_frame_source_ && observing_begin_frame_source_;
151 } 147 }
152 148
149 base::Callback<bool(void)> InCurrentFrame() const;
150
153 ~TestScheduler() override; 151 ~TestScheduler() override;
154 152
155 base::TimeDelta BeginImplFrameInterval() { 153 base::TimeDelta BeginImplFrameInterval() {
156 return begin_impl_frame_tracker_.Interval(); 154 return begin_impl_frame_tracker_.Interval();
157 } 155 }
158 156
159 // Note: This setting will be overriden on the next BeginFrame in the 157 // Note: This setting will be overriden on the next BeginFrame in the
160 // scheduler. To control the value it gets on the next BeginFrame 158 // scheduler. To control the value it gets on the next BeginFrame
161 // Pass in a fake CompositorTimingHistory that indicates BeginMainFrame 159 // Pass in a fake CompositorTimingHistory that indicates BeginMainFrame
162 // to Activation is fast. 160 // to Activation is fast.
163 void SetCriticalBeginMainFrameToActivateIsFast(bool is_fast) { 161 void SetCriticalBeginMainFrameToActivateIsFast(bool is_fast) {
164 state_machine_.SetCriticalBeginMainFrameToActivateIsFast(is_fast); 162 state_machine_.SetCriticalBeginMainFrameToActivateIsFast(is_fast);
165 } 163 }
166 164
165 bool OnBeginFrameDerivedImpl(const BeginFrameArgs& args) override;
166
167 protected: 167 protected:
168 // Overridden from Scheduler. 168 // Overridden from Scheduler.
169 base::TimeTicks Now() const override; 169 base::TimeTicks Now() const override;
170 170
171 private: 171 private:
172 bool InCurrentFrameCallback(int num_begin_frames) const;
173
172 base::SimpleTestTickClock* now_src_; 174 base::SimpleTestTickClock* now_src_;
175 int num_begin_frames_;
173 176
174 DISALLOW_COPY_AND_ASSIGN(TestScheduler); 177 DISALLOW_COPY_AND_ASSIGN(TestScheduler);
175 }; 178 };
176 179
177 } // namespace cc 180 } // namespace cc
178 181
179 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ 182 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698