OLD | NEW |
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 #include "cc/scheduler/scheduler.h" | 5 #include "cc/scheduler/scheduler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 states_.clear(); | 115 states_.clear(); |
116 draw_will_happen_ = true; | 116 draw_will_happen_ = true; |
117 swap_will_happen_if_draw_happens_ = true; | 117 swap_will_happen_if_draw_happens_ = true; |
118 num_draws_ = 0; | 118 num_draws_ = 0; |
119 log_anticipated_draw_time_change_ = false; | 119 log_anticipated_draw_time_change_ = false; |
120 begin_frame_is_sent_to_children_ = false; | 120 begin_frame_is_sent_to_children_ = false; |
121 } | 121 } |
122 | 122 |
123 TestScheduler* CreateScheduler(const SchedulerSettings& settings) { | 123 TestScheduler* CreateScheduler(const SchedulerSettings& settings) { |
124 scoped_ptr<FakeExternalBeginFrameSource> fake_external_begin_frame_source; | 124 scoped_ptr<FakeExternalBeginFrameSource> fake_external_begin_frame_source; |
125 if (settings.use_external_begin_frame_source && | 125 if (settings.use_external_begin_frame_source) { |
126 settings.throttle_frame_production) { | |
127 fake_external_begin_frame_source.reset( | 126 fake_external_begin_frame_source.reset( |
128 new FakeExternalBeginFrameSource(this)); | 127 new FakeExternalBeginFrameSource(this)); |
129 fake_external_begin_frame_source_ = | 128 fake_external_begin_frame_source_ = |
130 fake_external_begin_frame_source.get(); | 129 fake_external_begin_frame_source.get(); |
131 } | 130 } |
132 scheduler_ = TestScheduler::Create(now_src_, | 131 scheduler_ = TestScheduler::Create(now_src_, |
133 this, | 132 this, |
134 settings, | 133 settings, |
135 0, | 134 0, |
136 task_runner_, | 135 task_runner_, |
(...skipping 12 matching lines...) Expand all Loading... |
149 return scheduler_->frame_source().NeedsBeginFrames(); | 148 return scheduler_->frame_source().NeedsBeginFrames(); |
150 } | 149 } |
151 int num_draws() const { return num_draws_; } | 150 int num_draws() const { return num_draws_; } |
152 int num_actions_() const { return static_cast<int>(actions_.size()); } | 151 int num_actions_() const { return static_cast<int>(actions_.size()); } |
153 const char* Action(int i) const { return actions_[i]; } | 152 const char* Action(int i) const { return actions_[i]; } |
154 std::string StateForAction(int i) const { return states_[i]->ToString(); } | 153 std::string StateForAction(int i) const { return states_[i]->ToString(); } |
155 base::TimeTicks posted_begin_impl_frame_deadline() const { | 154 base::TimeTicks posted_begin_impl_frame_deadline() const { |
156 return posted_begin_impl_frame_deadline_; | 155 return posted_begin_impl_frame_deadline_; |
157 } | 156 } |
158 | 157 |
159 bool ExternalBeginFrame() { | |
160 return scheduler_->settings().use_external_begin_frame_source && | |
161 scheduler_->settings().throttle_frame_production; | |
162 } | |
163 | |
164 FakeExternalBeginFrameSource* fake_external_begin_frame_source() const { | 158 FakeExternalBeginFrameSource* fake_external_begin_frame_source() const { |
165 return fake_external_begin_frame_source_; | 159 return fake_external_begin_frame_source_; |
166 } | 160 } |
167 | 161 |
168 base::PowerMonitor* PowerMonitor() { return &power_monitor_; } | 162 base::PowerMonitor* PowerMonitor() { return &power_monitor_; } |
169 | 163 |
170 FakePowerMonitorSource* PowerMonitorSource() { | 164 FakePowerMonitorSource* PowerMonitorSource() { |
171 return fake_power_monitor_source_; | 165 return fake_power_monitor_source_; |
172 } | 166 } |
173 | 167 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.frames"), | 232 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.frames"), |
239 "FakeSchedulerClient::AdvanceFrame"); | 233 "FakeSchedulerClient::AdvanceFrame"); |
240 // Consume any previous deadline first, if no deadline is currently | 234 // Consume any previous deadline first, if no deadline is currently |
241 // pending, ImplFrameDeadlinePending will return false straight away and we | 235 // pending, ImplFrameDeadlinePending will return false straight away and we |
242 // will run no tasks. | 236 // will run no tasks. |
243 task_runner().RunTasksWhile(ImplFrameDeadlinePending(true)); | 237 task_runner().RunTasksWhile(ImplFrameDeadlinePending(true)); |
244 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); | 238 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
245 | 239 |
246 // Send the next BeginFrame message if using an external source, otherwise | 240 // Send the next BeginFrame message if using an external source, otherwise |
247 // it will be already in the task queue. | 241 // it will be already in the task queue. |
248 if (ExternalBeginFrame()) { | 242 if (scheduler_->settings().use_external_begin_frame_source && |
| 243 scheduler_->FrameProductionThrottled()) { |
249 SendNextBeginFrame(); | 244 SendNextBeginFrame(); |
250 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 245 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
251 } | 246 } |
252 | 247 |
253 // Then run tasks until new deadline is scheduled. | 248 // Then run tasks until new deadline is scheduled. |
254 EXPECT_TRUE(task_runner().RunTasksWhile(ImplFrameDeadlinePending(false))); | 249 EXPECT_TRUE(task_runner().RunTasksWhile(ImplFrameDeadlinePending(false))); |
255 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 250 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
256 } | 251 } |
257 | 252 |
258 void SendNextBeginFrame() { | 253 void SendNextBeginFrame() { |
259 DCHECK(ExternalBeginFrame()); | 254 DCHECK(scheduler_->settings().use_external_begin_frame_source); |
260 // Creep the time forward so that any BeginFrameArgs is not equal to the | 255 // Creep the time forward so that any BeginFrameArgs is not equal to the |
261 // last one otherwise we violate the BeginFrameSource contract. | 256 // last one otherwise we violate the BeginFrameSource contract. |
262 now_src_->AdvanceNow(BeginFrameArgs::DefaultInterval()); | 257 now_src_->AdvanceNow(BeginFrameArgs::DefaultInterval()); |
263 fake_external_begin_frame_source_->TestOnBeginFrame( | 258 fake_external_begin_frame_source_->TestOnBeginFrame( |
264 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now_src_)); | 259 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now_src_)); |
265 } | 260 } |
266 | 261 |
267 OrderedSimpleTaskRunner& task_runner() { return *task_runner_; } | 262 OrderedSimpleTaskRunner& task_runner() { return *task_runner_; } |
268 TestNowSource* now_src() { return now_src_.get(); } | 263 TestNowSource* now_src() { return now_src_.get(); } |
269 | 264 |
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 void BeginFramesNotFromClient(bool use_external_begin_frame_source, | 1498 void BeginFramesNotFromClient(bool use_external_begin_frame_source, |
1504 bool throttle_frame_production) { | 1499 bool throttle_frame_production) { |
1505 FakeSchedulerClient client; | 1500 FakeSchedulerClient client; |
1506 SchedulerSettings scheduler_settings; | 1501 SchedulerSettings scheduler_settings; |
1507 scheduler_settings.use_external_begin_frame_source = | 1502 scheduler_settings.use_external_begin_frame_source = |
1508 use_external_begin_frame_source; | 1503 use_external_begin_frame_source; |
1509 scheduler_settings.throttle_frame_production = throttle_frame_production; | 1504 scheduler_settings.throttle_frame_production = throttle_frame_production; |
1510 | 1505 |
1511 CREATE_SCHEDULER_AND_INIT_SURFACE(scheduler_settings); | 1506 CREATE_SCHEDULER_AND_INIT_SURFACE(scheduler_settings); |
1512 | 1507 |
1513 DCHECK(!client.fake_external_begin_frame_source()); | |
1514 | |
1515 // SetNeedsCommit should begin the frame on the next BeginImplFrame | 1508 // SetNeedsCommit should begin the frame on the next BeginImplFrame |
1516 // without calling SetNeedsBeginFrame. | 1509 // without calling SetNeedsBeginFrame. |
1517 scheduler->SetNeedsCommit(); | 1510 scheduler->SetNeedsCommit(); |
1518 EXPECT_NO_ACTION(client); | 1511 EXPECT_NO_ACTION(client); |
1519 client.Reset(); | 1512 client.Reset(); |
1520 | 1513 |
1521 // When the client-driven BeginFrame are disabled, the scheduler posts it's | 1514 // When the client-driven BeginFrame are disabled, the scheduler posts it's |
1522 // own BeginFrame tasks. | 1515 // own BeginFrame tasks. |
1523 client.task_runner().RunPendingTasks(); // Run posted BeginFrame. | 1516 client.task_runner().RunPendingTasks(); // Run posted BeginFrame. |
1524 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 1517 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1591 bool throttle_frame_production) { | 1584 bool throttle_frame_production) { |
1592 FakeSchedulerClient client; | 1585 FakeSchedulerClient client; |
1593 SchedulerSettings scheduler_settings; | 1586 SchedulerSettings scheduler_settings; |
1594 scheduler_settings.use_external_begin_frame_source = | 1587 scheduler_settings.use_external_begin_frame_source = |
1595 use_external_begin_frame_source; | 1588 use_external_begin_frame_source; |
1596 scheduler_settings.throttle_frame_production = throttle_frame_production; | 1589 scheduler_settings.throttle_frame_production = throttle_frame_production; |
1597 | 1590 |
1598 CREATE_SCHEDULER_AND_INIT_SURFACE(scheduler_settings); | 1591 CREATE_SCHEDULER_AND_INIT_SURFACE(scheduler_settings); |
1599 scheduler->SetEstimatedParentDrawTime(base::TimeDelta::FromMicroseconds(1)); | 1592 scheduler->SetEstimatedParentDrawTime(base::TimeDelta::FromMicroseconds(1)); |
1600 | 1593 |
1601 DCHECK(!client.fake_external_begin_frame_source()); | |
1602 | |
1603 // To test swap ack throttling, this test disables automatic swap acks. | 1594 // To test swap ack throttling, this test disables automatic swap acks. |
1604 scheduler->SetMaxSwapsPending(1); | 1595 scheduler->SetMaxSwapsPending(1); |
1605 client.SetAutomaticSwapAck(false); | 1596 client.SetAutomaticSwapAck(false); |
1606 | 1597 |
1607 // SetNeedsCommit should begin the frame on the next BeginImplFrame. | 1598 // SetNeedsCommit should begin the frame on the next BeginImplFrame. |
1608 client.Reset(); | 1599 client.Reset(); |
1609 scheduler->SetNeedsCommit(); | 1600 scheduler->SetNeedsCommit(); |
1610 EXPECT_NO_ACTION(client); | 1601 EXPECT_NO_ACTION(client); |
1611 client.Reset(); | 1602 client.Reset(); |
1612 | 1603 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1820 | 1811 |
1821 client.Reset(); | 1812 client.Reset(); |
1822 scheduler->NotifyBeginMainFrameStarted(); | 1813 scheduler->NotifyBeginMainFrameStarted(); |
1823 scheduler->NotifyReadyToCommit(); | 1814 scheduler->NotifyReadyToCommit(); |
1824 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); | 1815 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); |
1825 | 1816 |
1826 client.Reset(); | 1817 client.Reset(); |
1827 scheduler->DidLoseOutputSurface(); | 1818 scheduler->DidLoseOutputSurface(); |
1828 if (impl_side_painting) { | 1819 if (impl_side_painting) { |
1829 // Sync tree should be forced to activate. | 1820 // Sync tree should be forced to activate. |
1830 EXPECT_ACTION("SetNeedsBeginFrames(false)", client, 0, 2); | 1821 EXPECT_ACTION("ScheduledActionActivateSyncTree", client, 0, 2); |
1831 EXPECT_ACTION("ScheduledActionActivateSyncTree", client, 1, 2); | 1822 EXPECT_ACTION("SetNeedsBeginFrames(false)", client, 1, 2); |
1832 } else { | 1823 } else { |
1833 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client); | 1824 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client); |
1834 } | 1825 } |
1835 | 1826 |
1836 client.Reset(); | 1827 client.Reset(); |
1837 client.task_runner().RunPendingTasks(); // Run posted deadline. | 1828 client.task_runner().RunPendingTasks(); // Run posted deadline. |
1838 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); | 1829 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); |
1839 } | 1830 } |
1840 | 1831 |
1841 TEST(SchedulerTest, DidLoseOutputSurfaceAfterReadyToCommit) { | 1832 TEST(SchedulerTest, DidLoseOutputSurfaceAfterReadyToCommit) { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 // NotifyReadyToCommit should trigger the commit. | 1903 // NotifyReadyToCommit should trigger the commit. |
1913 client.Reset(); | 1904 client.Reset(); |
1914 scheduler->NotifyBeginMainFrameStarted(); | 1905 scheduler->NotifyBeginMainFrameStarted(); |
1915 scheduler->NotifyReadyToCommit(); | 1906 scheduler->NotifyReadyToCommit(); |
1916 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); | 1907 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); |
1917 EXPECT_TRUE(client.needs_begin_frames()); | 1908 EXPECT_TRUE(client.needs_begin_frames()); |
1918 | 1909 |
1919 client.Reset(); | 1910 client.Reset(); |
1920 EXPECT_FALSE(scheduler->IsBeginRetroFrameArgsEmpty()); | 1911 EXPECT_FALSE(scheduler->IsBeginRetroFrameArgsEmpty()); |
1921 scheduler->DidLoseOutputSurface(); | 1912 scheduler->DidLoseOutputSurface(); |
1922 EXPECT_ACTION("SetNeedsBeginFrames(false)", client, 0, 2); | 1913 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client, 0, 2); |
1923 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client, 1, 2); | 1914 EXPECT_ACTION("SetNeedsBeginFrames(false)", client, 1, 2); |
1924 EXPECT_TRUE(scheduler->IsBeginRetroFrameArgsEmpty()); | 1915 EXPECT_TRUE(scheduler->IsBeginRetroFrameArgsEmpty()); |
1925 | 1916 |
1926 // Posted BeginRetroFrame is aborted. | 1917 // Posted BeginRetroFrame is aborted. |
1927 client.Reset(); | 1918 client.Reset(); |
1928 client.task_runner().RunPendingTasks(); | 1919 client.task_runner().RunPendingTasks(); |
1929 EXPECT_NO_ACTION(client); | 1920 EXPECT_NO_ACTION(client); |
1930 } | 1921 } |
1931 | 1922 |
1932 TEST(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) { | 1923 TEST(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) { |
1933 FakeSchedulerClient client; | 1924 FakeSchedulerClient client; |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2193 // Disable auto-advancing of now_src | 2184 // Disable auto-advancing of now_src |
2194 client.task_runner().SetAutoAdvanceNowToPendingTasks(false); | 2185 client.task_runner().SetAutoAdvanceNowToPendingTasks(false); |
2195 | 2186 |
2196 // Deadline task is pending | 2187 // Deadline task is pending |
2197 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 2188 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
2198 client.task_runner().RunPendingTasks(); | 2189 client.task_runner().RunPendingTasks(); |
2199 // Deadline task runs immediately | 2190 // Deadline task runs immediately |
2200 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 2191 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
2201 } | 2192 } |
2202 | 2193 |
| 2194 // Tests to ensure frame sources can be successfully changed while drawing. |
| 2195 TEST(SchedulerTest, SwitchFrameSourceToUnthrottled) { |
| 2196 FakeSchedulerClient client; |
| 2197 SchedulerSettings scheduler_settings; |
| 2198 scheduler_settings.use_external_begin_frame_source = true; |
| 2199 |
| 2200 CREATE_SCHEDULER_AND_INIT_SURFACE(scheduler_settings); |
| 2201 |
| 2202 // SetNeedsRedraw should begin the frame on the next BeginImplFrame. |
| 2203 scheduler->SetNeedsRedraw(); |
| 2204 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); |
| 2205 client.Reset(); |
| 2206 |
| 2207 EXPECT_SCOPED(client.AdvanceFrame()); |
| 2208 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| 2209 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
| 2210 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| 2211 EXPECT_TRUE(client.needs_begin_frames()); |
| 2212 client.Reset(); |
| 2213 client.task_runner().RunPendingTasks(); // Run posted deadline. |
| 2214 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); |
| 2215 scheduler->SetNeedsRedraw(); |
| 2216 |
| 2217 // Switch to an unthrottled frame source. |
| 2218 scheduler->SetThrottleFrameProduction(false); |
| 2219 client.Reset(); |
| 2220 |
| 2221 // Unthrottled frame source will immediately begin a new frame. |
| 2222 client.task_runner().RunPendingTasks(); // Run posted BeginFrame. |
| 2223 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| 2224 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
| 2225 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| 2226 client.Reset(); |
| 2227 |
| 2228 // If we don't swap on the deadline, we wait for the next BeginFrame. |
| 2229 client.task_runner().RunPendingTasks(); // Run posted deadline. |
| 2230 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); |
| 2231 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
| 2232 client.Reset(); |
| 2233 } |
| 2234 |
| 2235 // Tests to ensure frame sources can be successfully changed while a frame |
| 2236 // deadline is pending. |
| 2237 TEST(SchedulerTest, SwitchFrameSourceToUnthrottledBeforeDeadline) { |
| 2238 FakeSchedulerClient client; |
| 2239 SchedulerSettings scheduler_settings; |
| 2240 scheduler_settings.use_external_begin_frame_source = true; |
| 2241 |
| 2242 CREATE_SCHEDULER_AND_INIT_SURFACE(scheduler_settings); |
| 2243 |
| 2244 // SetNeedsRedraw should begin the frame on the next BeginImplFrame. |
| 2245 scheduler->SetNeedsRedraw(); |
| 2246 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); |
| 2247 client.Reset(); |
| 2248 |
| 2249 EXPECT_SCOPED(client.AdvanceFrame()); |
| 2250 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| 2251 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
| 2252 |
| 2253 // Switch to an unthrottled frame source before the frame deadline is hit. |
| 2254 scheduler->SetThrottleFrameProduction(false); |
| 2255 client.Reset(); |
| 2256 |
| 2257 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| 2258 EXPECT_TRUE(client.needs_begin_frames()); |
| 2259 client.Reset(); |
| 2260 |
| 2261 client.task_runner() |
| 2262 .RunPendingTasks(); // Run posted deadline and BeginFrame. |
| 2263 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2); |
| 2264 // Unthrottled frame source will immediately begin a new frame. |
| 2265 EXPECT_ACTION("WillBeginImplFrame", client, 1, 2); |
| 2266 scheduler->SetNeedsRedraw(); |
| 2267 client.Reset(); |
| 2268 |
| 2269 client.task_runner().RunPendingTasks(); // Run posted deadline. |
| 2270 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2); |
| 2271 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); |
| 2272 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
| 2273 client.Reset(); |
| 2274 } |
| 2275 |
| 2276 // Tests to ensure that the active frame source can successfully be changed from |
| 2277 // unthrottled to throttled. |
| 2278 TEST(SchedulerTest, SwitchFrameSourceToThrottled) { |
| 2279 FakeSchedulerClient client; |
| 2280 SchedulerSettings scheduler_settings; |
| 2281 scheduler_settings.throttle_frame_production = false; |
| 2282 scheduler_settings.use_external_begin_frame_source = true; |
| 2283 |
| 2284 CREATE_SCHEDULER_AND_INIT_SURFACE(scheduler_settings); |
| 2285 |
| 2286 scheduler->SetNeedsRedraw(); |
| 2287 EXPECT_NO_ACTION(client); |
| 2288 client.Reset(); |
| 2289 |
| 2290 client.task_runner().RunPendingTasks(); // Run posted BeginFrame. |
| 2291 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| 2292 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
| 2293 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| 2294 client.Reset(); |
| 2295 |
| 2296 client.task_runner().RunPendingTasks(); // Run posted deadline. |
| 2297 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); |
| 2298 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
| 2299 client.Reset(); |
| 2300 |
| 2301 // Switch to a throttled frame source. |
| 2302 scheduler->SetThrottleFrameProduction(true); |
| 2303 client.Reset(); |
| 2304 |
| 2305 // SetNeedsRedraw should begin the frame on the next BeginImplFrame. |
| 2306 scheduler->SetNeedsRedraw(); |
| 2307 client.task_runner().RunPendingTasks(); |
| 2308 EXPECT_NO_ACTION(client); |
| 2309 client.Reset(); |
| 2310 |
| 2311 EXPECT_SCOPED(client.AdvanceFrame()); |
| 2312 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| 2313 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
| 2314 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| 2315 EXPECT_TRUE(client.needs_begin_frames()); |
| 2316 client.Reset(); |
| 2317 client.task_runner().RunPendingTasks(); // Run posted deadline. |
| 2318 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); |
| 2319 } |
| 2320 |
2203 } // namespace | 2321 } // namespace |
2204 } // namespace cc | 2322 } // namespace cc |
OLD | NEW |