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 #include "cc/scheduler/scheduler.h" | 4 #include "cc/scheduler/scheduler.h" |
5 | 5 |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 } while (false) | 27 } while (false) |
28 | 28 |
29 #define EXPECT_SINGLE_ACTION(action, client) \ | 29 #define EXPECT_SINGLE_ACTION(action, client) \ |
30 EXPECT_ACTION(action, client, 0, 1) | 30 EXPECT_ACTION(action, client, 0, 1) |
31 | 31 |
32 namespace cc { | 32 namespace cc { |
33 namespace { | 33 namespace { |
34 | 34 |
35 class FakeSchedulerClient; | 35 class FakeSchedulerClient; |
36 | 36 |
37 void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler, | 37 class FakeFrameSource : public BaseFrameSource { |
38 FakeSchedulerClient* client); | 38 public: |
| 39 FakeSchedulerClient* fake_client_; |
| 40 |
| 41 explicit FakeFrameSource(FakeSchedulerClient* fake_client) |
| 42 : BaseFrameSource(0), fake_client_(fake_client) {} |
| 43 |
| 44 virtual void SetNeedsBeginFrame(bool needs_begin_frame) OVERRIDE; |
| 45 virtual void SetTimeBaseAndInterval(base::TimeTicks timebase, |
| 46 base::TimeDelta interval) OVERRIDE {} |
| 47 virtual inline std::string FrameSourceType() const OVERRIDE { |
| 48 return "FakeFrameSource"; |
| 49 } |
| 50 |
| 51 void TestBeginFrame(BeginFrameArgs args) { |
| 52 BaseFrameSource::SendBeginFrame(args); |
| 53 } |
| 54 }; |
39 | 55 |
40 class FakeSchedulerClient : public SchedulerClient { | 56 class FakeSchedulerClient : public SchedulerClient { |
41 public: | 57 public: |
42 FakeSchedulerClient() : needs_begin_frame_(false), automatic_swap_ack_(true) { | 58 FakeSchedulerClient() |
| 59 : needs_begin_frame_(false), |
| 60 automatic_swap_ack_(true), |
| 61 frame_source_(this) { |
43 Reset(); | 62 Reset(); |
44 } | 63 } |
45 | 64 |
46 void Reset() { | 65 void Reset() { |
47 actions_.clear(); | 66 actions_.clear(); |
48 states_.clear(); | 67 states_.clear(); |
49 draw_will_happen_ = true; | 68 draw_will_happen_ = true; |
50 swap_will_happen_if_draw_happens_ = true; | 69 swap_will_happen_if_draw_happens_ = true; |
51 num_draws_ = 0; | 70 num_draws_ = 0; |
52 log_anticipated_draw_time_change_ = false; | 71 log_anticipated_draw_time_change_ = false; |
53 } | 72 } |
54 | 73 |
55 Scheduler* CreateScheduler(const SchedulerSettings& settings) { | 74 Scheduler* CreateScheduler(const SchedulerSettings& settings) { |
56 task_runner_ = new base::TestSimpleTaskRunner; | 75 task_runner_ = new base::TestSimpleTaskRunner; |
57 scheduler_ = Scheduler::Create(this, settings, 0, task_runner_); | 76 |
| 77 scheduler_ = Scheduler::Create(this, |
| 78 settings, |
| 79 0, |
| 80 static_cast<FrameSource*>(&frame_source_), |
| 81 task_runner_); |
58 return scheduler_.get(); | 82 return scheduler_.get(); |
59 } | 83 } |
60 | 84 |
61 // Most tests don't care about DidAnticipatedDrawTimeChange, so only record it | 85 // Most tests don't care about DidAnticipatedDrawTimeChange, so only record it |
62 // for tests that do. | 86 // for tests that do. |
63 void set_log_anticipated_draw_time_change(bool log) { | 87 void set_log_anticipated_draw_time_change(bool log) { |
64 log_anticipated_draw_time_change_ = log; | 88 log_anticipated_draw_time_change_ = log; |
65 } | 89 } |
66 bool needs_begin_frame() { return needs_begin_frame_; } | 90 bool needs_begin_frame() { return needs_begin_frame_; } |
67 int num_draws() const { return num_draws_; } | 91 int num_draws() const { return num_draws_; } |
(...skipping 21 matching lines...) Expand all Loading... |
89 draw_will_happen_ = draw_will_happen; | 113 draw_will_happen_ = draw_will_happen; |
90 } | 114 } |
91 void SetSwapWillHappenIfDrawHappens(bool swap_will_happen_if_draw_happens) { | 115 void SetSwapWillHappenIfDrawHappens(bool swap_will_happen_if_draw_happens) { |
92 swap_will_happen_if_draw_happens_ = swap_will_happen_if_draw_happens; | 116 swap_will_happen_if_draw_happens_ = swap_will_happen_if_draw_happens; |
93 } | 117 } |
94 void SetAutomaticSwapAck(bool automatic_swap_ack) { | 118 void SetAutomaticSwapAck(bool automatic_swap_ack) { |
95 automatic_swap_ack_ = automatic_swap_ack; | 119 automatic_swap_ack_ = automatic_swap_ack; |
96 } | 120 } |
97 | 121 |
98 // SchedulerClient implementation. | 122 // SchedulerClient implementation. |
99 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE { | |
100 actions_.push_back("SetNeedsBeginFrame"); | |
101 states_.push_back(scheduler_->StateAsValue().release()); | |
102 needs_begin_frame_ = enable; | |
103 } | |
104 virtual void WillBeginImplFrame(const BeginFrameArgs& args) OVERRIDE { | 123 virtual void WillBeginImplFrame(const BeginFrameArgs& args) OVERRIDE { |
105 actions_.push_back("WillBeginImplFrame"); | 124 actions_.push_back("WillBeginImplFrame"); |
106 states_.push_back(scheduler_->StateAsValue().release()); | 125 states_.push_back(scheduler_->StateAsValue().release()); |
107 } | 126 } |
108 virtual void ScheduledActionSendBeginMainFrame() OVERRIDE { | 127 virtual void ScheduledActionSendBeginMainFrame() OVERRIDE { |
109 actions_.push_back("ScheduledActionSendBeginMainFrame"); | 128 actions_.push_back("ScheduledActionSendBeginMainFrame"); |
110 states_.push_back(scheduler_->StateAsValue().release()); | 129 states_.push_back(scheduler_->StateAsValue().release()); |
111 } | 130 } |
112 virtual void ScheduledActionAnimate() OVERRIDE { | 131 virtual void ScheduledActionAnimate() OVERRIDE { |
113 actions_.push_back("ScheduledActionAnimate"); | 132 actions_.push_back("ScheduledActionAnimate"); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 } | 199 } |
181 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() OVERRIDE { | 200 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() OVERRIDE { |
182 return base::TimeDelta(); | 201 return base::TimeDelta(); |
183 } | 202 } |
184 virtual base::TimeDelta CommitToActivateDurationEstimate() OVERRIDE { | 203 virtual base::TimeDelta CommitToActivateDurationEstimate() OVERRIDE { |
185 return base::TimeDelta(); | 204 return base::TimeDelta(); |
186 } | 205 } |
187 | 206 |
188 virtual void DidBeginImplFrameDeadline() OVERRIDE {} | 207 virtual void DidBeginImplFrameDeadline() OVERRIDE {} |
189 | 208 |
| 209 FakeFrameSource& frame_source() { return frame_source_; } |
| 210 |
190 protected: | 211 protected: |
191 bool needs_begin_frame_; | 212 bool needs_begin_frame_; |
192 bool draw_will_happen_; | 213 bool draw_will_happen_; |
193 bool swap_will_happen_if_draw_happens_; | 214 bool swap_will_happen_if_draw_happens_; |
194 bool automatic_swap_ack_; | 215 bool automatic_swap_ack_; |
195 int num_draws_; | 216 int num_draws_; |
196 bool log_anticipated_draw_time_change_; | 217 bool log_anticipated_draw_time_change_; |
197 base::TimeTicks posted_begin_impl_frame_deadline_; | 218 base::TimeTicks posted_begin_impl_frame_deadline_; |
198 std::vector<const char*> actions_; | 219 std::vector<const char*> actions_; |
199 ScopedVector<base::Value> states_; | 220 ScopedVector<base::Value> states_; |
200 scoped_ptr<Scheduler> scheduler_; | 221 scoped_ptr<Scheduler> scheduler_; |
201 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; | 222 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; |
| 223 |
| 224 friend FakeFrameSource; |
| 225 FakeFrameSource frame_source_; |
202 }; | 226 }; |
203 | 227 |
| 228 void FakeFrameSource::SetNeedsBeginFrame(bool needs_begin_frame) { |
| 229 fake_client_->actions_.push_back("SetNeedsBeginFrame"); |
| 230 fake_client_->states_.push_back( |
| 231 fake_client_->scheduler_->StateAsValue().release()); |
| 232 fake_client_->needs_begin_frame_ = needs_begin_frame; |
| 233 } |
| 234 |
204 void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler, | 235 void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler, |
205 FakeSchedulerClient* client) { | 236 FakeSchedulerClient* client) { |
206 bool client_initiates_begin_frame = | 237 bool client_initiates_begin_frame = |
207 scheduler->settings().begin_frame_scheduling_enabled && | 238 scheduler->settings().begin_frame_scheduling_enabled && |
208 scheduler->settings().throttle_frame_production; | 239 scheduler->settings().throttle_frame_production; |
209 | 240 |
210 scheduler->DidCreateAndInitializeOutputSurface(); | 241 scheduler->DidCreateAndInitializeOutputSurface(); |
211 scheduler->SetNeedsCommit(); | 242 scheduler->SetNeedsCommit(); |
212 scheduler->NotifyBeginMainFrameStarted(); | 243 scheduler->NotifyBeginMainFrameStarted(); |
213 scheduler->NotifyReadyToCommit(); | 244 scheduler->NotifyReadyToCommit(); |
214 // Go through the motions to draw the commit. | 245 // Go through the motions to draw the commit. |
215 if (client_initiates_begin_frame) | 246 if (client_initiates_begin_frame) |
216 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 247 client->frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
217 else | 248 else |
218 client->task_runner().RunPendingTasks(); // Run posted BeginFrame. | 249 client->task_runner().RunPendingTasks(); // Run posted BeginFrame. |
219 | 250 |
220 // Run the posted deadline task. | 251 // Run the posted deadline task. |
221 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 252 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
222 client->task_runner().RunPendingTasks(); | 253 client->task_runner().RunPendingTasks(); |
223 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 254 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
224 | 255 |
225 // We need another BeginImplFrame so Scheduler calls | 256 // We need another BeginImplFrame so Scheduler calls |
226 // SetNeedsBeginFrame(false). | 257 // SetNeedsBeginFrame(false). |
227 if (client_initiates_begin_frame) | 258 if (client_initiates_begin_frame) |
228 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 259 client->frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
229 else | 260 else |
230 client->task_runner().RunPendingTasks(); // Run posted BeginFrame. | 261 client->task_runner().RunPendingTasks(); // Run posted BeginFrame. |
231 | 262 |
232 // Run the posted deadline task. | 263 // Run the posted deadline task. |
233 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 264 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
234 client->task_runner().RunPendingTasks(); | 265 client->task_runner().RunPendingTasks(); |
235 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 266 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
236 } | 267 } |
237 | 268 |
238 TEST(SchedulerTest, InitializeOutputSurfaceDoesNotBeginImplFrame) { | 269 TEST(SchedulerTest, InitializeOutputSurfaceDoesNotBeginImplFrame) { |
(...skipping 21 matching lines...) Expand all Loading... |
260 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); | 291 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); |
261 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); | 292 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
262 | 293 |
263 // SetNeedsCommit should begin the frame on the next BeginImplFrame. | 294 // SetNeedsCommit should begin the frame on the next BeginImplFrame. |
264 client.Reset(); | 295 client.Reset(); |
265 scheduler->SetNeedsCommit(); | 296 scheduler->SetNeedsCommit(); |
266 EXPECT_TRUE(client.needs_begin_frame()); | 297 EXPECT_TRUE(client.needs_begin_frame()); |
267 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); | 298 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
268 client.Reset(); | 299 client.Reset(); |
269 | 300 |
270 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 301 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
271 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 302 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
272 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | 303 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
273 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 304 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
274 EXPECT_TRUE(client.needs_begin_frame()); | 305 EXPECT_TRUE(client.needs_begin_frame()); |
275 client.Reset(); | 306 client.Reset(); |
276 | 307 |
277 // If we don't swap on the deadline, we wait for the next BeginFrame. | 308 // If we don't swap on the deadline, we wait for the next BeginFrame. |
278 client.task_runner().RunPendingTasks(); // Run posted deadline. | 309 client.task_runner().RunPendingTasks(); // Run posted deadline. |
279 EXPECT_EQ(0, client.num_actions_()); | 310 EXPECT_EQ(0, client.num_actions_()); |
280 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 311 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
281 EXPECT_TRUE(client.needs_begin_frame()); | 312 EXPECT_TRUE(client.needs_begin_frame()); |
282 client.Reset(); | 313 client.Reset(); |
283 | 314 |
284 // NotifyReadyToCommit should trigger the commit. | 315 // NotifyReadyToCommit should trigger the commit. |
285 scheduler->NotifyBeginMainFrameStarted(); | 316 scheduler->NotifyBeginMainFrameStarted(); |
286 scheduler->NotifyReadyToCommit(); | 317 scheduler->NotifyReadyToCommit(); |
287 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); | 318 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); |
288 EXPECT_TRUE(client.needs_begin_frame()); | 319 EXPECT_TRUE(client.needs_begin_frame()); |
289 client.Reset(); | 320 client.Reset(); |
290 | 321 |
291 // BeginImplFrame should prepare the draw. | 322 // BeginImplFrame should prepare the draw. |
292 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 323 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
293 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 324 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
294 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); | 325 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
295 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 326 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
296 EXPECT_TRUE(client.needs_begin_frame()); | 327 EXPECT_TRUE(client.needs_begin_frame()); |
297 client.Reset(); | 328 client.Reset(); |
298 | 329 |
299 // BeginImplFrame deadline should draw. | 330 // BeginImplFrame deadline should draw. |
300 client.task_runner().RunPendingTasks(); // Run posted deadline. | 331 client.task_runner().RunPendingTasks(); // Run posted deadline. |
301 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); | 332 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); |
302 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 333 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
303 EXPECT_TRUE(client.needs_begin_frame()); | 334 EXPECT_TRUE(client.needs_begin_frame()); |
304 client.Reset(); | 335 client.Reset(); |
305 | 336 |
306 // The following BeginImplFrame deadline should SetNeedsBeginFrame(false) | 337 // The following BeginImplFrame deadline should SetNeedsBeginFrame(false) |
307 // to avoid excessive toggles. | 338 // to avoid excessive toggles. |
308 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 339 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
309 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); | 340 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); |
310 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 341 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
311 client.Reset(); | 342 client.Reset(); |
312 | 343 |
313 client.task_runner().RunPendingTasks(); // Run posted deadline. | 344 client.task_runner().RunPendingTasks(); // Run posted deadline. |
314 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); | 345 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
315 EXPECT_FALSE(client.needs_begin_frame()); | 346 EXPECT_FALSE(client.needs_begin_frame()); |
316 client.Reset(); | 347 client.Reset(); |
317 } | 348 } |
318 | 349 |
319 TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) { | 350 TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) { |
320 FakeSchedulerClient client; | 351 FakeSchedulerClient client; |
321 SchedulerSettings scheduler_settings; | 352 SchedulerSettings scheduler_settings; |
322 Scheduler* scheduler = client.CreateScheduler(scheduler_settings); | 353 Scheduler* scheduler = client.CreateScheduler(scheduler_settings); |
323 scheduler->SetCanStart(); | 354 scheduler->SetCanStart(); |
324 scheduler->SetVisible(true); | 355 scheduler->SetVisible(true); |
325 scheduler->SetCanDraw(true); | 356 scheduler->SetCanDraw(true); |
326 | 357 |
327 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); | 358 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); |
328 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); | 359 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
329 client.Reset(); | 360 client.Reset(); |
330 | 361 |
331 // SetNeedsCommit should begin the frame. | 362 // SetNeedsCommit should begin the frame. |
332 scheduler->SetNeedsCommit(); | 363 scheduler->SetNeedsCommit(); |
333 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); | 364 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
334 | 365 |
335 client.Reset(); | 366 client.Reset(); |
336 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 367 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
337 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 368 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
338 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | 369 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
339 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 370 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
340 | 371 |
341 EXPECT_TRUE(client.needs_begin_frame()); | 372 EXPECT_TRUE(client.needs_begin_frame()); |
342 client.Reset(); | 373 client.Reset(); |
343 | 374 |
344 // Now SetNeedsCommit again. Calling here means we need a second commit. | 375 // Now SetNeedsCommit again. Calling here means we need a second commit. |
345 scheduler->SetNeedsCommit(); | 376 scheduler->SetNeedsCommit(); |
346 EXPECT_EQ(client.num_actions_(), 0); | 377 EXPECT_EQ(client.num_actions_(), 0); |
347 client.Reset(); | 378 client.Reset(); |
348 | 379 |
349 // Finish the first commit. | 380 // Finish the first commit. |
350 scheduler->NotifyBeginMainFrameStarted(); | 381 scheduler->NotifyBeginMainFrameStarted(); |
351 scheduler->NotifyReadyToCommit(); | 382 scheduler->NotifyReadyToCommit(); |
352 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); | 383 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); |
353 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 384 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
354 client.Reset(); | 385 client.Reset(); |
355 client.task_runner().RunPendingTasks(); // Run posted deadline. | 386 client.task_runner().RunPendingTasks(); // Run posted deadline. |
356 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2); | 387 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2); |
357 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); | 388 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); |
358 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 389 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
359 | 390 |
360 // Because we just swapped, the Scheduler should also request the next | 391 // Because we just swapped, the Scheduler should also request the next |
361 // BeginImplFrame from the OutputSurface. | 392 // BeginImplFrame from the OutputSurface. |
362 EXPECT_TRUE(client.needs_begin_frame()); | 393 EXPECT_TRUE(client.needs_begin_frame()); |
363 client.Reset(); | 394 client.Reset(); |
364 // Since another commit is needed, the next BeginImplFrame should initiate | 395 // Since another commit is needed, the next BeginImplFrame should initiate |
365 // the second commit. | 396 // the second commit. |
366 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 397 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
367 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 398 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
368 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | 399 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
369 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 400 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
370 client.Reset(); | 401 client.Reset(); |
371 | 402 |
372 // Finishing the commit before the deadline should post a new deadline task | 403 // Finishing the commit before the deadline should post a new deadline task |
373 // to trigger the deadline early. | 404 // to trigger the deadline early. |
374 scheduler->NotifyBeginMainFrameStarted(); | 405 scheduler->NotifyBeginMainFrameStarted(); |
375 scheduler->NotifyReadyToCommit(); | 406 scheduler->NotifyReadyToCommit(); |
376 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); | 407 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); |
377 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 408 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
378 client.Reset(); | 409 client.Reset(); |
379 client.task_runner().RunPendingTasks(); // Run posted deadline. | 410 client.task_runner().RunPendingTasks(); // Run posted deadline. |
380 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2); | 411 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2); |
381 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); | 412 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); |
382 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 413 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
383 EXPECT_TRUE(client.needs_begin_frame()); | 414 EXPECT_TRUE(client.needs_begin_frame()); |
384 client.Reset(); | 415 client.Reset(); |
385 | 416 |
386 // On the next BeginImplFrame, verify we go back to a quiescent state and | 417 // On the next BeginImplFrame, verify we go back to a quiescent state and |
387 // no longer request BeginImplFrames. | 418 // no longer request BeginImplFrames. |
388 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 419 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
389 client.task_runner().RunPendingTasks(); // Run posted deadline. | 420 client.task_runner().RunPendingTasks(); // Run posted deadline. |
390 EXPECT_FALSE(client.needs_begin_frame()); | 421 EXPECT_FALSE(client.needs_begin_frame()); |
391 client.Reset(); | 422 client.Reset(); |
392 } | 423 } |
393 | 424 |
394 class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient { | 425 class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient { |
395 public: | 426 public: |
396 virtual void ScheduledActionSendBeginMainFrame() OVERRIDE {} | 427 virtual void ScheduledActionSendBeginMainFrame() OVERRIDE {} |
397 virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapIfPossible() | 428 virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapIfPossible() |
398 OVERRIDE { | 429 OVERRIDE { |
(...skipping 28 matching lines...) Expand all Loading... |
427 scheduler->SetVisible(true); | 458 scheduler->SetVisible(true); |
428 scheduler->SetCanDraw(true); | 459 scheduler->SetCanDraw(true); |
429 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); | 460 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
430 client.Reset(); | 461 client.Reset(); |
431 | 462 |
432 scheduler->SetNeedsRedraw(); | 463 scheduler->SetNeedsRedraw(); |
433 EXPECT_TRUE(scheduler->RedrawPending()); | 464 EXPECT_TRUE(scheduler->RedrawPending()); |
434 EXPECT_TRUE(client.needs_begin_frame()); | 465 EXPECT_TRUE(client.needs_begin_frame()); |
435 EXPECT_EQ(0, client.num_draws()); | 466 EXPECT_EQ(0, client.num_draws()); |
436 | 467 |
437 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 468 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
438 client.task_runner().RunPendingTasks(); // Run posted deadline. | 469 client.task_runner().RunPendingTasks(); // Run posted deadline. |
439 EXPECT_EQ(1, client.num_draws()); | 470 EXPECT_EQ(1, client.num_draws()); |
440 EXPECT_TRUE(scheduler->RedrawPending()); | 471 EXPECT_TRUE(scheduler->RedrawPending()); |
441 EXPECT_TRUE(client.needs_begin_frame()); | 472 EXPECT_TRUE(client.needs_begin_frame()); |
442 | 473 |
443 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 474 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
444 client.task_runner().RunPendingTasks(); // Run posted deadline. | 475 client.task_runner().RunPendingTasks(); // Run posted deadline. |
445 EXPECT_EQ(2, client.num_draws()); | 476 EXPECT_EQ(2, client.num_draws()); |
446 EXPECT_FALSE(scheduler->RedrawPending()); | 477 EXPECT_FALSE(scheduler->RedrawPending()); |
447 EXPECT_TRUE(client.needs_begin_frame()); | 478 EXPECT_TRUE(client.needs_begin_frame()); |
448 | 479 |
449 // We stop requesting BeginImplFrames after a BeginImplFrame where we don't | 480 // We stop requesting BeginImplFrames after a BeginImplFrame where we don't |
450 // swap. | 481 // swap. |
451 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 482 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
452 client.task_runner().RunPendingTasks(); // Run posted deadline. | 483 client.task_runner().RunPendingTasks(); // Run posted deadline. |
453 EXPECT_EQ(2, client.num_draws()); | 484 EXPECT_EQ(2, client.num_draws()); |
454 EXPECT_FALSE(scheduler->RedrawPending()); | 485 EXPECT_FALSE(scheduler->RedrawPending()); |
455 EXPECT_FALSE(client.needs_begin_frame()); | 486 EXPECT_FALSE(client.needs_begin_frame()); |
456 } | 487 } |
457 | 488 |
458 // Test that requesting redraw inside a failed draw doesn't lose the request. | 489 // Test that requesting redraw inside a failed draw doesn't lose the request. |
459 TEST(SchedulerTest, RequestRedrawInsideFailedDraw) { | 490 TEST(SchedulerTest, RequestRedrawInsideFailedDraw) { |
460 SchedulerClientThatsetNeedsDrawInsideDraw client; | 491 SchedulerClientThatsetNeedsDrawInsideDraw client; |
461 SchedulerSettings default_scheduler_settings; | 492 SchedulerSettings default_scheduler_settings; |
462 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); | 493 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); |
463 scheduler->SetCanStart(); | 494 scheduler->SetCanStart(); |
464 scheduler->SetVisible(true); | 495 scheduler->SetVisible(true); |
465 scheduler->SetCanDraw(true); | 496 scheduler->SetCanDraw(true); |
466 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); | 497 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
467 client.Reset(); | 498 client.Reset(); |
468 | 499 |
469 client.SetDrawWillHappen(false); | 500 client.SetDrawWillHappen(false); |
470 | 501 |
471 scheduler->SetNeedsRedraw(); | 502 scheduler->SetNeedsRedraw(); |
472 EXPECT_TRUE(scheduler->RedrawPending()); | 503 EXPECT_TRUE(scheduler->RedrawPending()); |
473 EXPECT_TRUE(client.needs_begin_frame()); | 504 EXPECT_TRUE(client.needs_begin_frame()); |
474 EXPECT_EQ(0, client.num_draws()); | 505 EXPECT_EQ(0, client.num_draws()); |
475 | 506 |
476 // Fail the draw. | 507 // Fail the draw. |
477 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 508 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
478 client.task_runner().RunPendingTasks(); // Run posted deadline. | 509 client.task_runner().RunPendingTasks(); // Run posted deadline. |
479 EXPECT_EQ(1, client.num_draws()); | 510 EXPECT_EQ(1, client.num_draws()); |
480 | 511 |
481 // We have a commit pending and the draw failed, and we didn't lose the redraw | 512 // We have a commit pending and the draw failed, and we didn't lose the redraw |
482 // request. | 513 // request. |
483 EXPECT_TRUE(scheduler->CommitPending()); | 514 EXPECT_TRUE(scheduler->CommitPending()); |
484 EXPECT_TRUE(scheduler->RedrawPending()); | 515 EXPECT_TRUE(scheduler->RedrawPending()); |
485 EXPECT_TRUE(client.needs_begin_frame()); | 516 EXPECT_TRUE(client.needs_begin_frame()); |
486 | 517 |
487 // Fail the draw again. | 518 // Fail the draw again. |
488 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 519 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
489 client.task_runner().RunPendingTasks(); // Run posted deadline. | 520 client.task_runner().RunPendingTasks(); // Run posted deadline. |
490 EXPECT_EQ(2, client.num_draws()); | 521 EXPECT_EQ(2, client.num_draws()); |
491 EXPECT_TRUE(scheduler->CommitPending()); | 522 EXPECT_TRUE(scheduler->CommitPending()); |
492 EXPECT_TRUE(scheduler->RedrawPending()); | 523 EXPECT_TRUE(scheduler->RedrawPending()); |
493 EXPECT_TRUE(client.needs_begin_frame()); | 524 EXPECT_TRUE(client.needs_begin_frame()); |
494 | 525 |
495 // Draw successfully. | 526 // Draw successfully. |
496 client.SetDrawWillHappen(true); | 527 client.SetDrawWillHappen(true); |
497 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 528 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
498 client.task_runner().RunPendingTasks(); // Run posted deadline. | 529 client.task_runner().RunPendingTasks(); // Run posted deadline. |
499 EXPECT_EQ(3, client.num_draws()); | 530 EXPECT_EQ(3, client.num_draws()); |
500 EXPECT_TRUE(scheduler->CommitPending()); | 531 EXPECT_TRUE(scheduler->CommitPending()); |
501 EXPECT_FALSE(scheduler->RedrawPending()); | 532 EXPECT_FALSE(scheduler->RedrawPending()); |
502 EXPECT_TRUE(client.needs_begin_frame()); | 533 EXPECT_TRUE(client.needs_begin_frame()); |
503 } | 534 } |
504 | 535 |
505 class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeSchedulerClient { | 536 class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeSchedulerClient { |
506 public: | 537 public: |
507 SchedulerClientThatSetNeedsCommitInsideDraw() | 538 SchedulerClientThatSetNeedsCommitInsideDraw() |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); | 579 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
549 client.Reset(); | 580 client.Reset(); |
550 | 581 |
551 EXPECT_FALSE(client.needs_begin_frame()); | 582 EXPECT_FALSE(client.needs_begin_frame()); |
552 scheduler->SetNeedsRedraw(); | 583 scheduler->SetNeedsRedraw(); |
553 EXPECT_TRUE(scheduler->RedrawPending()); | 584 EXPECT_TRUE(scheduler->RedrawPending()); |
554 EXPECT_EQ(0, client.num_draws()); | 585 EXPECT_EQ(0, client.num_draws()); |
555 EXPECT_TRUE(client.needs_begin_frame()); | 586 EXPECT_TRUE(client.needs_begin_frame()); |
556 | 587 |
557 client.SetNeedsCommitOnNextDraw(); | 588 client.SetNeedsCommitOnNextDraw(); |
558 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 589 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
559 client.SetNeedsCommitOnNextDraw(); | 590 client.SetNeedsCommitOnNextDraw(); |
560 client.task_runner().RunPendingTasks(); // Run posted deadline. | 591 client.task_runner().RunPendingTasks(); // Run posted deadline. |
561 EXPECT_EQ(1, client.num_draws()); | 592 EXPECT_EQ(1, client.num_draws()); |
562 EXPECT_TRUE(scheduler->CommitPending()); | 593 EXPECT_TRUE(scheduler->CommitPending()); |
563 EXPECT_TRUE(client.needs_begin_frame()); | 594 EXPECT_TRUE(client.needs_begin_frame()); |
564 scheduler->NotifyBeginMainFrameStarted(); | 595 scheduler->NotifyBeginMainFrameStarted(); |
565 scheduler->NotifyReadyToCommit(); | 596 scheduler->NotifyReadyToCommit(); |
566 | 597 |
567 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 598 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
568 client.task_runner().RunPendingTasks(); // Run posted deadline. | 599 client.task_runner().RunPendingTasks(); // Run posted deadline. |
569 EXPECT_EQ(2, client.num_draws()); | 600 EXPECT_EQ(2, client.num_draws()); |
570 | 601 |
571 EXPECT_FALSE(scheduler->RedrawPending()); | 602 EXPECT_FALSE(scheduler->RedrawPending()); |
572 EXPECT_FALSE(scheduler->CommitPending()); | 603 EXPECT_FALSE(scheduler->CommitPending()); |
573 EXPECT_TRUE(client.needs_begin_frame()); | 604 EXPECT_TRUE(client.needs_begin_frame()); |
574 | 605 |
575 // We stop requesting BeginImplFrames after a BeginImplFrame where we don't | 606 // We stop requesting BeginImplFrames after a BeginImplFrame where we don't |
576 // swap. | 607 // swap. |
577 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 608 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
578 client.task_runner().RunPendingTasks(); // Run posted deadline. | 609 client.task_runner().RunPendingTasks(); // Run posted deadline. |
579 EXPECT_EQ(2, client.num_draws()); | 610 EXPECT_EQ(2, client.num_draws()); |
580 EXPECT_FALSE(scheduler->RedrawPending()); | 611 EXPECT_FALSE(scheduler->RedrawPending()); |
581 EXPECT_FALSE(scheduler->CommitPending()); | 612 EXPECT_FALSE(scheduler->CommitPending()); |
582 EXPECT_FALSE(client.needs_begin_frame()); | 613 EXPECT_FALSE(client.needs_begin_frame()); |
583 } | 614 } |
584 | 615 |
585 // Tests that when a draw fails then the pending commit should not be dropped. | 616 // Tests that when a draw fails then the pending commit should not be dropped. |
586 TEST(SchedulerTest, RequestCommitInsideFailedDraw) { | 617 TEST(SchedulerTest, RequestCommitInsideFailedDraw) { |
587 SchedulerClientThatsetNeedsDrawInsideDraw client; | 618 SchedulerClientThatsetNeedsDrawInsideDraw client; |
588 SchedulerSettings default_scheduler_settings; | 619 SchedulerSettings default_scheduler_settings; |
589 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); | 620 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); |
590 scheduler->SetCanStart(); | 621 scheduler->SetCanStart(); |
591 scheduler->SetVisible(true); | 622 scheduler->SetVisible(true); |
592 scheduler->SetCanDraw(true); | 623 scheduler->SetCanDraw(true); |
593 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); | 624 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
594 client.Reset(); | 625 client.Reset(); |
595 | 626 |
596 client.SetDrawWillHappen(false); | 627 client.SetDrawWillHappen(false); |
597 | 628 |
598 scheduler->SetNeedsRedraw(); | 629 scheduler->SetNeedsRedraw(); |
599 EXPECT_TRUE(scheduler->RedrawPending()); | 630 EXPECT_TRUE(scheduler->RedrawPending()); |
600 EXPECT_TRUE(client.needs_begin_frame()); | 631 EXPECT_TRUE(client.needs_begin_frame()); |
601 EXPECT_EQ(0, client.num_draws()); | 632 EXPECT_EQ(0, client.num_draws()); |
602 | 633 |
603 // Fail the draw. | 634 // Fail the draw. |
604 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 635 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
605 client.task_runner().RunPendingTasks(); // Run posted deadline. | 636 client.task_runner().RunPendingTasks(); // Run posted deadline. |
606 EXPECT_EQ(1, client.num_draws()); | 637 EXPECT_EQ(1, client.num_draws()); |
607 | 638 |
608 // We have a commit pending and the draw failed, and we didn't lose the commit | 639 // We have a commit pending and the draw failed, and we didn't lose the commit |
609 // request. | 640 // request. |
610 EXPECT_TRUE(scheduler->CommitPending()); | 641 EXPECT_TRUE(scheduler->CommitPending()); |
611 EXPECT_TRUE(scheduler->RedrawPending()); | 642 EXPECT_TRUE(scheduler->RedrawPending()); |
612 EXPECT_TRUE(client.needs_begin_frame()); | 643 EXPECT_TRUE(client.needs_begin_frame()); |
613 | 644 |
614 // Fail the draw again. | 645 // Fail the draw again. |
615 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 646 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
616 | 647 |
617 client.task_runner().RunPendingTasks(); // Run posted deadline. | 648 client.task_runner().RunPendingTasks(); // Run posted deadline. |
618 EXPECT_EQ(2, client.num_draws()); | 649 EXPECT_EQ(2, client.num_draws()); |
619 EXPECT_TRUE(scheduler->CommitPending()); | 650 EXPECT_TRUE(scheduler->CommitPending()); |
620 EXPECT_TRUE(scheduler->RedrawPending()); | 651 EXPECT_TRUE(scheduler->RedrawPending()); |
621 EXPECT_TRUE(client.needs_begin_frame()); | 652 EXPECT_TRUE(client.needs_begin_frame()); |
622 | 653 |
623 // Draw successfully. | 654 // Draw successfully. |
624 client.SetDrawWillHappen(true); | 655 client.SetDrawWillHappen(true); |
625 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 656 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
626 client.task_runner().RunPendingTasks(); // Run posted deadline. | 657 client.task_runner().RunPendingTasks(); // Run posted deadline. |
627 EXPECT_EQ(3, client.num_draws()); | 658 EXPECT_EQ(3, client.num_draws()); |
628 EXPECT_TRUE(scheduler->CommitPending()); | 659 EXPECT_TRUE(scheduler->CommitPending()); |
629 EXPECT_FALSE(scheduler->RedrawPending()); | 660 EXPECT_FALSE(scheduler->RedrawPending()); |
630 EXPECT_TRUE(client.needs_begin_frame()); | 661 EXPECT_TRUE(client.needs_begin_frame()); |
631 } | 662 } |
632 | 663 |
633 TEST(SchedulerTest, NoSwapWhenDrawFails) { | 664 TEST(SchedulerTest, NoSwapWhenDrawFails) { |
634 SchedulerClientThatSetNeedsCommitInsideDraw client; | 665 SchedulerClientThatSetNeedsCommitInsideDraw client; |
635 SchedulerSettings default_scheduler_settings; | 666 SchedulerSettings default_scheduler_settings; |
636 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); | 667 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); |
637 scheduler->SetCanStart(); | 668 scheduler->SetCanStart(); |
638 scheduler->SetVisible(true); | 669 scheduler->SetVisible(true); |
639 scheduler->SetCanDraw(true); | 670 scheduler->SetCanDraw(true); |
640 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); | 671 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
641 client.Reset(); | 672 client.Reset(); |
642 | 673 |
643 scheduler->SetNeedsRedraw(); | 674 scheduler->SetNeedsRedraw(); |
644 EXPECT_TRUE(scheduler->RedrawPending()); | 675 EXPECT_TRUE(scheduler->RedrawPending()); |
645 EXPECT_TRUE(client.needs_begin_frame()); | 676 EXPECT_TRUE(client.needs_begin_frame()); |
646 EXPECT_EQ(0, client.num_draws()); | 677 EXPECT_EQ(0, client.num_draws()); |
647 | 678 |
648 // Draw successfully, this starts a new frame. | 679 // Draw successfully, this starts a new frame. |
649 client.SetNeedsCommitOnNextDraw(); | 680 client.SetNeedsCommitOnNextDraw(); |
650 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 681 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
651 client.task_runner().RunPendingTasks(); // Run posted deadline. | 682 client.task_runner().RunPendingTasks(); // Run posted deadline. |
652 EXPECT_EQ(1, client.num_draws()); | 683 EXPECT_EQ(1, client.num_draws()); |
653 | 684 |
654 scheduler->SetNeedsRedraw(); | 685 scheduler->SetNeedsRedraw(); |
655 EXPECT_TRUE(scheduler->RedrawPending()); | 686 EXPECT_TRUE(scheduler->RedrawPending()); |
656 EXPECT_TRUE(client.needs_begin_frame()); | 687 EXPECT_TRUE(client.needs_begin_frame()); |
657 | 688 |
658 // Fail to draw, this should not start a frame. | 689 // Fail to draw, this should not start a frame. |
659 client.SetDrawWillHappen(false); | 690 client.SetDrawWillHappen(false); |
660 client.SetNeedsCommitOnNextDraw(); | 691 client.SetNeedsCommitOnNextDraw(); |
661 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 692 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
662 client.task_runner().RunPendingTasks(); // Run posted deadline. | 693 client.task_runner().RunPendingTasks(); // Run posted deadline. |
663 EXPECT_EQ(2, client.num_draws()); | 694 EXPECT_EQ(2, client.num_draws()); |
664 } | 695 } |
665 | 696 |
666 TEST(SchedulerTest, NoSwapWhenSwapFailsDuringForcedCommit) { | 697 TEST(SchedulerTest, NoSwapWhenSwapFailsDuringForcedCommit) { |
667 FakeSchedulerClient client; | 698 FakeSchedulerClient client; |
668 SchedulerSettings default_scheduler_settings; | 699 SchedulerSettings default_scheduler_settings; |
669 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); | 700 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); |
670 | 701 |
671 // Tell the client that it will fail to swap. | 702 // Tell the client that it will fail to swap. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 EXPECT_TRUE(scheduler->RedrawPending()); | 768 EXPECT_TRUE(scheduler->RedrawPending()); |
738 EXPECT_TRUE(scheduler->ManageTilesPending()); | 769 EXPECT_TRUE(scheduler->ManageTilesPending()); |
739 EXPECT_TRUE(client.needs_begin_frame()); | 770 EXPECT_TRUE(client.needs_begin_frame()); |
740 EXPECT_EQ(0, client.num_draws()); | 771 EXPECT_EQ(0, client.num_draws()); |
741 EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles")); | 772 EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles")); |
742 EXPECT_FALSE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); | 773 EXPECT_FALSE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); |
743 | 774 |
744 // We have no immediate actions to perform, so the BeginImplFrame should post | 775 // We have no immediate actions to perform, so the BeginImplFrame should post |
745 // the deadline task. | 776 // the deadline task. |
746 client.Reset(); | 777 client.Reset(); |
747 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 778 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
748 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 779 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
749 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); | 780 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
750 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 781 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
751 | 782 |
752 // On the deadline, he actions should have occured in the right order. | 783 // On the deadline, he actions should have occured in the right order. |
753 client.Reset(); | 784 client.Reset(); |
754 client.task_runner().RunPendingTasks(); // Run posted deadline. | 785 client.task_runner().RunPendingTasks(); // Run posted deadline. |
755 EXPECT_EQ(1, client.num_draws()); | 786 EXPECT_EQ(1, client.num_draws()); |
756 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); | 787 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); |
757 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles")); | 788 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles")); |
758 EXPECT_LT(client.ActionIndex("ScheduledActionDrawAndSwapIfPossible"), | 789 EXPECT_LT(client.ActionIndex("ScheduledActionDrawAndSwapIfPossible"), |
759 client.ActionIndex("ScheduledActionManageTiles")); | 790 client.ActionIndex("ScheduledActionManageTiles")); |
760 EXPECT_FALSE(scheduler->RedrawPending()); | 791 EXPECT_FALSE(scheduler->RedrawPending()); |
761 EXPECT_FALSE(scheduler->ManageTilesPending()); | 792 EXPECT_FALSE(scheduler->ManageTilesPending()); |
762 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 793 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
763 | 794 |
764 // Request a draw. We don't need a ManageTiles yet. | 795 // Request a draw. We don't need a ManageTiles yet. |
765 client.Reset(); | 796 client.Reset(); |
766 scheduler->SetNeedsRedraw(); | 797 scheduler->SetNeedsRedraw(); |
767 EXPECT_TRUE(scheduler->RedrawPending()); | 798 EXPECT_TRUE(scheduler->RedrawPending()); |
768 EXPECT_FALSE(scheduler->ManageTilesPending()); | 799 EXPECT_FALSE(scheduler->ManageTilesPending()); |
769 EXPECT_TRUE(client.needs_begin_frame()); | 800 EXPECT_TRUE(client.needs_begin_frame()); |
770 EXPECT_EQ(0, client.num_draws()); | 801 EXPECT_EQ(0, client.num_draws()); |
771 | 802 |
772 // We have no immediate actions to perform, so the BeginImplFrame should post | 803 // We have no immediate actions to perform, so the BeginImplFrame should post |
773 // the deadline task. | 804 // the deadline task. |
774 client.Reset(); | 805 client.Reset(); |
775 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 806 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
776 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 807 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
777 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); | 808 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
778 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 809 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
779 | 810 |
780 // Draw. The draw will trigger SetNeedsManageTiles, and | 811 // Draw. The draw will trigger SetNeedsManageTiles, and |
781 // then the ManageTiles action will be triggered after the Draw. | 812 // then the ManageTiles action will be triggered after the Draw. |
782 // Afterwards, neither a draw nor ManageTiles are pending. | 813 // Afterwards, neither a draw nor ManageTiles are pending. |
783 client.Reset(); | 814 client.Reset(); |
784 client.task_runner().RunPendingTasks(); // Run posted deadline. | 815 client.task_runner().RunPendingTasks(); // Run posted deadline. |
785 EXPECT_EQ(1, client.num_draws()); | 816 EXPECT_EQ(1, client.num_draws()); |
786 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); | 817 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); |
787 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles")); | 818 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles")); |
788 EXPECT_LT(client.ActionIndex("ScheduledActionDrawAndSwapIfPossible"), | 819 EXPECT_LT(client.ActionIndex("ScheduledActionDrawAndSwapIfPossible"), |
789 client.ActionIndex("ScheduledActionManageTiles")); | 820 client.ActionIndex("ScheduledActionManageTiles")); |
790 EXPECT_FALSE(scheduler->RedrawPending()); | 821 EXPECT_FALSE(scheduler->RedrawPending()); |
791 EXPECT_FALSE(scheduler->ManageTilesPending()); | 822 EXPECT_FALSE(scheduler->ManageTilesPending()); |
792 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 823 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
793 | 824 |
794 // We need a BeginImplFrame where we don't swap to go idle. | 825 // We need a BeginImplFrame where we don't swap to go idle. |
795 client.Reset(); | 826 client.Reset(); |
796 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 827 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
797 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); | 828 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); |
798 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 829 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
799 client.Reset(); | 830 client.Reset(); |
800 client.task_runner().RunPendingTasks(); // Run posted deadline. | 831 client.task_runner().RunPendingTasks(); // Run posted deadline. |
801 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); | 832 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
802 EXPECT_FALSE(client.needs_begin_frame()); | 833 EXPECT_FALSE(client.needs_begin_frame()); |
803 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 834 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
804 EXPECT_EQ(0, client.num_draws()); | 835 EXPECT_EQ(0, client.num_draws()); |
805 | 836 |
806 // Now trigger a ManageTiles outside of a draw. We will then need | 837 // Now trigger a ManageTiles outside of a draw. We will then need |
807 // a begin-frame for the ManageTiles, but we don't need a draw. | 838 // a begin-frame for the ManageTiles, but we don't need a draw. |
808 client.Reset(); | 839 client.Reset(); |
809 EXPECT_FALSE(client.needs_begin_frame()); | 840 EXPECT_FALSE(client.needs_begin_frame()); |
810 scheduler->SetNeedsManageTiles(); | 841 scheduler->SetNeedsManageTiles(); |
811 EXPECT_TRUE(client.needs_begin_frame()); | 842 EXPECT_TRUE(client.needs_begin_frame()); |
812 EXPECT_TRUE(scheduler->ManageTilesPending()); | 843 EXPECT_TRUE(scheduler->ManageTilesPending()); |
813 EXPECT_FALSE(scheduler->RedrawPending()); | 844 EXPECT_FALSE(scheduler->RedrawPending()); |
814 | 845 |
815 // BeginImplFrame. There will be no draw, only ManageTiles. | 846 // BeginImplFrame. There will be no draw, only ManageTiles. |
816 client.Reset(); | 847 client.Reset(); |
817 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 848 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
818 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); | 849 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); |
819 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 850 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
820 client.Reset(); | 851 client.Reset(); |
821 client.task_runner().RunPendingTasks(); // Run posted deadline. | 852 client.task_runner().RunPendingTasks(); // Run posted deadline. |
822 EXPECT_EQ(0, client.num_draws()); | 853 EXPECT_EQ(0, client.num_draws()); |
823 EXPECT_FALSE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); | 854 EXPECT_FALSE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); |
824 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles")); | 855 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles")); |
825 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 856 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
826 } | 857 } |
827 | 858 |
828 // Test that ManageTiles only happens once per frame. If an external caller | 859 // Test that ManageTiles only happens once per frame. If an external caller |
829 // initiates it, then the state machine should not ManageTiles on that frame. | 860 // initiates it, then the state machine should not ManageTiles on that frame. |
830 TEST(SchedulerTest, ManageTilesOncePerFrame) { | 861 TEST(SchedulerTest, ManageTilesOncePerFrame) { |
831 FakeSchedulerClient client; | 862 FakeSchedulerClient client; |
832 SchedulerSettings default_scheduler_settings; | 863 SchedulerSettings default_scheduler_settings; |
833 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); | 864 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); |
834 scheduler->SetCanStart(); | 865 scheduler->SetCanStart(); |
835 scheduler->SetVisible(true); | 866 scheduler->SetVisible(true); |
836 scheduler->SetCanDraw(true); | 867 scheduler->SetCanDraw(true); |
837 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); | 868 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
838 | 869 |
839 // If DidManageTiles during a frame, then ManageTiles should not occur again. | 870 // If DidManageTiles during a frame, then ManageTiles should not occur again. |
840 scheduler->SetNeedsManageTiles(); | 871 scheduler->SetNeedsManageTiles(); |
841 scheduler->SetNeedsRedraw(); | 872 scheduler->SetNeedsRedraw(); |
842 client.Reset(); | 873 client.Reset(); |
843 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 874 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
844 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 875 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
845 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); | 876 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
846 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 877 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
847 | 878 |
848 EXPECT_TRUE(scheduler->ManageTilesPending()); | 879 EXPECT_TRUE(scheduler->ManageTilesPending()); |
849 scheduler->DidManageTiles(); // An explicit ManageTiles. | 880 scheduler->DidManageTiles(); // An explicit ManageTiles. |
850 EXPECT_FALSE(scheduler->ManageTilesPending()); | 881 EXPECT_FALSE(scheduler->ManageTilesPending()); |
851 | 882 |
852 client.Reset(); | 883 client.Reset(); |
853 client.task_runner().RunPendingTasks(); // Run posted deadline. | 884 client.task_runner().RunPendingTasks(); // Run posted deadline. |
854 EXPECT_EQ(1, client.num_draws()); | 885 EXPECT_EQ(1, client.num_draws()); |
855 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); | 886 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); |
856 EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles")); | 887 EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles")); |
857 EXPECT_FALSE(scheduler->RedrawPending()); | 888 EXPECT_FALSE(scheduler->RedrawPending()); |
858 EXPECT_FALSE(scheduler->ManageTilesPending()); | 889 EXPECT_FALSE(scheduler->ManageTilesPending()); |
859 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 890 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
860 | 891 |
861 // Next frame without DidManageTiles should ManageTiles with draw. | 892 // Next frame without DidManageTiles should ManageTiles with draw. |
862 scheduler->SetNeedsManageTiles(); | 893 scheduler->SetNeedsManageTiles(); |
863 scheduler->SetNeedsRedraw(); | 894 scheduler->SetNeedsRedraw(); |
864 client.Reset(); | 895 client.Reset(); |
865 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 896 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
866 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 897 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
867 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); | 898 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
868 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 899 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
869 | 900 |
870 client.Reset(); | 901 client.Reset(); |
871 client.task_runner().RunPendingTasks(); // Run posted deadline. | 902 client.task_runner().RunPendingTasks(); // Run posted deadline. |
872 EXPECT_EQ(1, client.num_draws()); | 903 EXPECT_EQ(1, client.num_draws()); |
873 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); | 904 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); |
874 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles")); | 905 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles")); |
875 EXPECT_LT(client.ActionIndex("ScheduledActionDrawAndSwapIfPossible"), | 906 EXPECT_LT(client.ActionIndex("ScheduledActionDrawAndSwapIfPossible"), |
876 client.ActionIndex("ScheduledActionManageTiles")); | 907 client.ActionIndex("ScheduledActionManageTiles")); |
877 EXPECT_FALSE(scheduler->RedrawPending()); | 908 EXPECT_FALSE(scheduler->RedrawPending()); |
878 EXPECT_FALSE(scheduler->ManageTilesPending()); | 909 EXPECT_FALSE(scheduler->ManageTilesPending()); |
879 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 910 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
880 scheduler->DidManageTiles(); // Corresponds to ScheduledActionManageTiles | 911 scheduler->DidManageTiles(); // Corresponds to ScheduledActionManageTiles |
881 | 912 |
882 // If we get another DidManageTiles within the same frame, we should | 913 // If we get another DidManageTiles within the same frame, we should |
883 // not ManageTiles on the next frame. | 914 // not ManageTiles on the next frame. |
884 scheduler->DidManageTiles(); // An explicit ManageTiles. | 915 scheduler->DidManageTiles(); // An explicit ManageTiles. |
885 scheduler->SetNeedsManageTiles(); | 916 scheduler->SetNeedsManageTiles(); |
886 scheduler->SetNeedsRedraw(); | 917 scheduler->SetNeedsRedraw(); |
887 client.Reset(); | 918 client.Reset(); |
888 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 919 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
889 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 920 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
890 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); | 921 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
891 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 922 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
892 | 923 |
893 EXPECT_TRUE(scheduler->ManageTilesPending()); | 924 EXPECT_TRUE(scheduler->ManageTilesPending()); |
894 | 925 |
895 client.Reset(); | 926 client.Reset(); |
896 client.task_runner().RunPendingTasks(); // Run posted deadline. | 927 client.task_runner().RunPendingTasks(); // Run posted deadline. |
897 EXPECT_EQ(1, client.num_draws()); | 928 EXPECT_EQ(1, client.num_draws()); |
898 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); | 929 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); |
899 EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles")); | 930 EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles")); |
900 EXPECT_FALSE(scheduler->RedrawPending()); | 931 EXPECT_FALSE(scheduler->RedrawPending()); |
901 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 932 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
902 | 933 |
903 // If we get another DidManageTiles, we should not ManageTiles on the next | 934 // If we get another DidManageTiles, we should not ManageTiles on the next |
904 // frame. This verifies we don't alternate calling ManageTiles once and twice. | 935 // frame. This verifies we don't alternate calling ManageTiles once and twice. |
905 EXPECT_TRUE(scheduler->ManageTilesPending()); | 936 EXPECT_TRUE(scheduler->ManageTilesPending()); |
906 scheduler->DidManageTiles(); // An explicit ManageTiles. | 937 scheduler->DidManageTiles(); // An explicit ManageTiles. |
907 EXPECT_FALSE(scheduler->ManageTilesPending()); | 938 EXPECT_FALSE(scheduler->ManageTilesPending()); |
908 scheduler->SetNeedsManageTiles(); | 939 scheduler->SetNeedsManageTiles(); |
909 scheduler->SetNeedsRedraw(); | 940 scheduler->SetNeedsRedraw(); |
910 client.Reset(); | 941 client.Reset(); |
911 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 942 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
912 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 943 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
913 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); | 944 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
914 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 945 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
915 | 946 |
916 EXPECT_TRUE(scheduler->ManageTilesPending()); | 947 EXPECT_TRUE(scheduler->ManageTilesPending()); |
917 | 948 |
918 client.Reset(); | 949 client.Reset(); |
919 client.task_runner().RunPendingTasks(); // Run posted deadline. | 950 client.task_runner().RunPendingTasks(); // Run posted deadline. |
920 EXPECT_EQ(1, client.num_draws()); | 951 EXPECT_EQ(1, client.num_draws()); |
921 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); | 952 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); |
922 EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles")); | 953 EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles")); |
923 EXPECT_FALSE(scheduler->RedrawPending()); | 954 EXPECT_FALSE(scheduler->RedrawPending()); |
924 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 955 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
925 | 956 |
926 // Next frame without DidManageTiles should ManageTiles with draw. | 957 // Next frame without DidManageTiles should ManageTiles with draw. |
927 scheduler->SetNeedsManageTiles(); | 958 scheduler->SetNeedsManageTiles(); |
928 scheduler->SetNeedsRedraw(); | 959 scheduler->SetNeedsRedraw(); |
929 client.Reset(); | 960 client.Reset(); |
930 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 961 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
931 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 962 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
932 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); | 963 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
933 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 964 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
934 | 965 |
935 client.Reset(); | 966 client.Reset(); |
936 client.task_runner().RunPendingTasks(); // Run posted deadline. | 967 client.task_runner().RunPendingTasks(); // Run posted deadline. |
937 EXPECT_EQ(1, client.num_draws()); | 968 EXPECT_EQ(1, client.num_draws()); |
938 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); | 969 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); |
939 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles")); | 970 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles")); |
940 EXPECT_LT(client.ActionIndex("ScheduledActionDrawAndSwapIfPossible"), | 971 EXPECT_LT(client.ActionIndex("ScheduledActionDrawAndSwapIfPossible"), |
941 client.ActionIndex("ScheduledActionManageTiles")); | 972 client.ActionIndex("ScheduledActionManageTiles")); |
942 EXPECT_FALSE(scheduler->RedrawPending()); | 973 EXPECT_FALSE(scheduler->RedrawPending()); |
943 EXPECT_FALSE(scheduler->ManageTilesPending()); | 974 EXPECT_FALSE(scheduler->ManageTilesPending()); |
944 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 975 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
945 scheduler->DidManageTiles(); // Corresponds to ScheduledActionManageTiles | 976 scheduler->DidManageTiles(); // Corresponds to ScheduledActionManageTiles |
946 } | 977 } |
947 | 978 |
948 TEST(SchedulerTest, TriggerBeginFrameDeadlineEarly) { | 979 TEST(SchedulerTest, TriggerBeginFrameDeadlineEarly) { |
949 SchedulerClientNeedsManageTilesInDraw client; | 980 SchedulerClientNeedsManageTilesInDraw client; |
950 SchedulerSettings default_scheduler_settings; | 981 SchedulerSettings default_scheduler_settings; |
951 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); | 982 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); |
952 scheduler->SetCanStart(); | 983 scheduler->SetCanStart(); |
953 scheduler->SetVisible(true); | 984 scheduler->SetVisible(true); |
954 scheduler->SetCanDraw(true); | 985 scheduler->SetCanDraw(true); |
955 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); | 986 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
956 | 987 |
957 client.Reset(); | 988 client.Reset(); |
958 scheduler->SetNeedsRedraw(); | 989 scheduler->SetNeedsRedraw(); |
959 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 990 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
960 | 991 |
961 // The deadline should be zero since there is no work other than drawing | 992 // The deadline should be zero since there is no work other than drawing |
962 // pending. | 993 // pending. |
963 EXPECT_EQ(base::TimeTicks(), client.posted_begin_impl_frame_deadline()); | 994 EXPECT_EQ(base::TimeTicks(), client.posted_begin_impl_frame_deadline()); |
964 } | 995 } |
965 | 996 |
966 class SchedulerClientWithFixedEstimates : public FakeSchedulerClient { | 997 class SchedulerClientWithFixedEstimates : public FakeSchedulerClient { |
967 public: | 998 public: |
968 SchedulerClientWithFixedEstimates( | 999 SchedulerClientWithFixedEstimates( |
969 base::TimeDelta draw_duration, | 1000 base::TimeDelta draw_duration, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 scheduler->SetCanStart(); | 1036 scheduler->SetCanStart(); |
1006 scheduler->SetVisible(true); | 1037 scheduler->SetVisible(true); |
1007 scheduler->SetCanDraw(true); | 1038 scheduler->SetCanDraw(true); |
1008 scheduler->SetSmoothnessTakesPriority(smoothness_takes_priority); | 1039 scheduler->SetSmoothnessTakesPriority(smoothness_takes_priority); |
1009 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); | 1040 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
1010 | 1041 |
1011 // Impl thread hits deadline before commit finishes. | 1042 // Impl thread hits deadline before commit finishes. |
1012 client.Reset(); | 1043 client.Reset(); |
1013 scheduler->SetNeedsCommit(); | 1044 scheduler->SetNeedsCommit(); |
1014 EXPECT_FALSE(scheduler->MainThreadIsInHighLatencyMode()); | 1045 EXPECT_FALSE(scheduler->MainThreadIsInHighLatencyMode()); |
1015 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 1046 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
1016 EXPECT_FALSE(scheduler->MainThreadIsInHighLatencyMode()); | 1047 EXPECT_FALSE(scheduler->MainThreadIsInHighLatencyMode()); |
1017 client.task_runner().RunPendingTasks(); // Run posted deadline. | 1048 client.task_runner().RunPendingTasks(); // Run posted deadline. |
1018 EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); | 1049 EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); |
1019 scheduler->NotifyBeginMainFrameStarted(); | 1050 scheduler->NotifyBeginMainFrameStarted(); |
1020 scheduler->NotifyReadyToCommit(); | 1051 scheduler->NotifyReadyToCommit(); |
1021 EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); | 1052 EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); |
1022 EXPECT_TRUE(client.HasAction("ScheduledActionSendBeginMainFrame")); | 1053 EXPECT_TRUE(client.HasAction("ScheduledActionSendBeginMainFrame")); |
1023 | 1054 |
1024 client.Reset(); | 1055 client.Reset(); |
1025 scheduler->SetNeedsCommit(); | 1056 scheduler->SetNeedsCommit(); |
1026 EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); | 1057 EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); |
1027 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting()); | 1058 client.frame_source().TestBeginFrame(BeginFrameArgs::CreateForTesting()); |
1028 EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); | 1059 EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); |
1029 client.task_runner().RunPendingTasks(); // Run posted deadline. | 1060 client.task_runner().RunPendingTasks(); // Run posted deadline. |
1030 EXPECT_EQ(scheduler->MainThreadIsInHighLatencyMode(), | 1061 EXPECT_EQ(scheduler->MainThreadIsInHighLatencyMode(), |
1031 should_send_begin_main_frame); | 1062 should_send_begin_main_frame); |
1032 EXPECT_EQ(client.HasAction("ScheduledActionSendBeginMainFrame"), | 1063 EXPECT_EQ(client.HasAction("ScheduledActionSendBeginMainFrame"), |
1033 should_send_begin_main_frame); | 1064 should_send_begin_main_frame); |
1034 } | 1065 } |
1035 | 1066 |
1036 TEST(SchedulerTest, | 1067 TEST(SchedulerTest, |
1037 SkipMainFrameIfHighLatencyAndCanCommitAndActivateBeforeDeadline) { | 1068 SkipMainFrameIfHighLatencyAndCanCommitAndActivateBeforeDeadline) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 scheduler->DidCreateAndInitializeOutputSurface(); | 1107 scheduler->DidCreateAndInitializeOutputSurface(); |
1077 | 1108 |
1078 scheduler->SetNeedsCommit(); | 1109 scheduler->SetNeedsCommit(); |
1079 EXPECT_TRUE(scheduler->CommitPending()); | 1110 EXPECT_TRUE(scheduler->CommitPending()); |
1080 scheduler->NotifyBeginMainFrameStarted(); | 1111 scheduler->NotifyBeginMainFrameStarted(); |
1081 scheduler->NotifyReadyToCommit(); | 1112 scheduler->NotifyReadyToCommit(); |
1082 scheduler->SetNeedsRedraw(); | 1113 scheduler->SetNeedsRedraw(); |
1083 | 1114 |
1084 BeginFrameArgs frame_args = BeginFrameArgs::CreateForTesting(); | 1115 BeginFrameArgs frame_args = BeginFrameArgs::CreateForTesting(); |
1085 frame_args.interval = base::TimeDelta::FromMilliseconds(1000); | 1116 frame_args.interval = base::TimeDelta::FromMilliseconds(1000); |
1086 scheduler->BeginFrame(frame_args); | 1117 client.frame_source().TestBeginFrame(frame_args); |
1087 | 1118 |
1088 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1119 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1089 client.task_runner().RunPendingTasks(); // Run posted deadline. | 1120 client.task_runner().RunPendingTasks(); // Run posted deadline. |
1090 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 1121 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
1091 | 1122 |
1092 scheduler->DidSwapBuffers(); | 1123 scheduler->DidSwapBuffers(); |
1093 scheduler->DidSwapBuffersComplete(); | 1124 scheduler->DidSwapBuffersComplete(); |
1094 | 1125 |
1095 // At this point, we've drawn a frame. Start another commit, but hold off on | 1126 // At this point, we've drawn a frame. Start another commit, but hold off on |
1096 // the NotifyReadyToCommit for now. | 1127 // the NotifyReadyToCommit for now. |
1097 EXPECT_FALSE(scheduler->CommitPending()); | 1128 EXPECT_FALSE(scheduler->CommitPending()); |
1098 scheduler->SetNeedsCommit(); | 1129 scheduler->SetNeedsCommit(); |
1099 scheduler->BeginFrame(frame_args); | 1130 client.frame_source().TestBeginFrame(frame_args); |
1100 EXPECT_TRUE(scheduler->CommitPending()); | 1131 EXPECT_TRUE(scheduler->CommitPending()); |
1101 | 1132 |
1102 // Draw and swap the frame, but don't ack the swap to simulate the Browser | 1133 // Draw and swap the frame, but don't ack the swap to simulate the Browser |
1103 // blocking on the renderer. | 1134 // blocking on the renderer. |
1104 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1135 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1105 client.task_runner().RunPendingTasks(); // Run posted deadline. | 1136 client.task_runner().RunPendingTasks(); // Run posted deadline. |
1106 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 1137 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
1107 scheduler->DidSwapBuffers(); | 1138 scheduler->DidSwapBuffers(); |
1108 | 1139 |
1109 // Spin the event loop a few times and make sure we get more | 1140 // Spin the event loop a few times and make sure we get more |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 client.Reset(); | 1180 client.Reset(); |
1150 scheduler->SetNeedsCommit(); | 1181 scheduler->SetNeedsCommit(); |
1151 EXPECT_TRUE(client.needs_begin_frame()); | 1182 EXPECT_TRUE(client.needs_begin_frame()); |
1152 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); | 1183 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
1153 client.Reset(); | 1184 client.Reset(); |
1154 | 1185 |
1155 // Create a BeginFrame with a long deadline to avoid race conditions. | 1186 // Create a BeginFrame with a long deadline to avoid race conditions. |
1156 // This is the first BeginFrame, which will be handled immediately. | 1187 // This is the first BeginFrame, which will be handled immediately. |
1157 BeginFrameArgs args = BeginFrameArgs::CreateForTesting(); | 1188 BeginFrameArgs args = BeginFrameArgs::CreateForTesting(); |
1158 args.deadline += base::TimeDelta::FromHours(1); | 1189 args.deadline += base::TimeDelta::FromHours(1); |
1159 scheduler->BeginFrame(args); | 1190 client.frame_source().TestBeginFrame(args); |
1160 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 1191 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
1161 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | 1192 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
1162 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1193 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1163 EXPECT_TRUE(client.needs_begin_frame()); | 1194 EXPECT_TRUE(client.needs_begin_frame()); |
1164 client.Reset(); | 1195 client.Reset(); |
1165 | 1196 |
1166 // Queue BeginFrames while we are still handling the previous BeginFrame. | 1197 // Queue BeginFrames while we are still handling the previous BeginFrame. |
1167 args.frame_time += base::TimeDelta::FromSeconds(1); | 1198 args.frame_time += base::TimeDelta::FromSeconds(1); |
1168 scheduler->BeginFrame(args); | 1199 client.frame_source().TestBeginFrame(args); |
1169 args.frame_time += base::TimeDelta::FromSeconds(1); | 1200 args.frame_time += base::TimeDelta::FromSeconds(1); |
1170 scheduler->BeginFrame(args); | 1201 client.frame_source().TestBeginFrame(args); |
1171 | 1202 |
1172 // If we don't swap on the deadline, we wait for the next BeginImplFrame. | 1203 // If we don't swap on the deadline, we wait for the next BeginImplFrame. |
1173 client.task_runner().RunPendingTasks(); // Run posted deadline. | 1204 client.task_runner().RunPendingTasks(); // Run posted deadline. |
1174 EXPECT_EQ(0, client.num_actions_()); | 1205 EXPECT_EQ(0, client.num_actions_()); |
1175 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 1206 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
1176 EXPECT_TRUE(client.needs_begin_frame()); | 1207 EXPECT_TRUE(client.needs_begin_frame()); |
1177 client.Reset(); | 1208 client.Reset(); |
1178 | 1209 |
1179 // NotifyReadyToCommit should trigger the commit. | 1210 // NotifyReadyToCommit should trigger the commit. |
1180 scheduler->NotifyBeginMainFrameStarted(); | 1211 scheduler->NotifyBeginMainFrameStarted(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 client.Reset(); | 1259 client.Reset(); |
1229 scheduler->SetNeedsCommit(); | 1260 scheduler->SetNeedsCommit(); |
1230 EXPECT_TRUE(client.needs_begin_frame()); | 1261 EXPECT_TRUE(client.needs_begin_frame()); |
1231 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); | 1262 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); |
1232 client.Reset(); | 1263 client.Reset(); |
1233 | 1264 |
1234 // Create a BeginFrame with a long deadline to avoid race conditions. | 1265 // Create a BeginFrame with a long deadline to avoid race conditions. |
1235 // This is the first BeginFrame, which will be handled immediately. | 1266 // This is the first BeginFrame, which will be handled immediately. |
1236 BeginFrameArgs args = BeginFrameArgs::CreateForTesting(); | 1267 BeginFrameArgs args = BeginFrameArgs::CreateForTesting(); |
1237 args.deadline += base::TimeDelta::FromHours(1); | 1268 args.deadline += base::TimeDelta::FromHours(1); |
1238 scheduler->BeginFrame(args); | 1269 client.frame_source().TestBeginFrame(args); |
1239 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 1270 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
1240 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | 1271 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
1241 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1272 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1242 EXPECT_TRUE(client.needs_begin_frame()); | 1273 EXPECT_TRUE(client.needs_begin_frame()); |
1243 client.Reset(); | 1274 client.Reset(); |
1244 | 1275 |
1245 // Queue BeginFrame while we are still handling the previous BeginFrame. | 1276 // Queue BeginFrame while we are still handling the previous BeginFrame. |
1246 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1277 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1247 args.frame_time += base::TimeDelta::FromSeconds(1); | 1278 args.frame_time += base::TimeDelta::FromSeconds(1); |
1248 scheduler->BeginFrame(args); | 1279 client.frame_source().TestBeginFrame(args); |
1249 EXPECT_EQ(0, client.num_actions_()); | 1280 EXPECT_EQ(0, client.num_actions_()); |
1250 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1281 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1251 client.Reset(); | 1282 client.Reset(); |
1252 | 1283 |
1253 // NotifyReadyToCommit should trigger the pending commit and draw. | 1284 // NotifyReadyToCommit should trigger the pending commit and draw. |
1254 scheduler->NotifyBeginMainFrameStarted(); | 1285 scheduler->NotifyBeginMainFrameStarted(); |
1255 scheduler->NotifyReadyToCommit(); | 1286 scheduler->NotifyReadyToCommit(); |
1256 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); | 1287 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); |
1257 EXPECT_TRUE(client.needs_begin_frame()); | 1288 EXPECT_TRUE(client.needs_begin_frame()); |
1258 client.Reset(); | 1289 client.Reset(); |
(...skipping 10 matching lines...) Expand all Loading... |
1269 // but not a BeginMainFrame or draw. | 1300 // but not a BeginMainFrame or draw. |
1270 scheduler->SetNeedsCommit(); | 1301 scheduler->SetNeedsCommit(); |
1271 client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame. | 1302 client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame. |
1272 EXPECT_ACTION("WillBeginImplFrame", client, 0, 1); | 1303 EXPECT_ACTION("WillBeginImplFrame", client, 0, 1); |
1273 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1304 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1274 EXPECT_TRUE(client.needs_begin_frame()); | 1305 EXPECT_TRUE(client.needs_begin_frame()); |
1275 client.Reset(); | 1306 client.Reset(); |
1276 | 1307 |
1277 // Queue BeginFrame while we are still handling the previous BeginFrame. | 1308 // Queue BeginFrame while we are still handling the previous BeginFrame. |
1278 args.frame_time += base::TimeDelta::FromSeconds(1); | 1309 args.frame_time += base::TimeDelta::FromSeconds(1); |
1279 scheduler->BeginFrame(args); | 1310 client.frame_source().TestBeginFrame(args); |
1280 EXPECT_EQ(0, client.num_actions_()); | 1311 EXPECT_EQ(0, client.num_actions_()); |
1281 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1312 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1282 EXPECT_TRUE(client.needs_begin_frame()); | 1313 EXPECT_TRUE(client.needs_begin_frame()); |
1283 client.Reset(); | 1314 client.Reset(); |
1284 | 1315 |
1285 // Take us out of a swap throttled state. | 1316 // Take us out of a swap throttled state. |
1286 scheduler->DidSwapBuffersComplete(); | 1317 scheduler->DidSwapBuffersComplete(); |
1287 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1); | 1318 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1); |
1288 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1319 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1289 EXPECT_TRUE(client.needs_begin_frame()); | 1320 EXPECT_TRUE(client.needs_begin_frame()); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 TEST(SchedulerTest, | 1515 TEST(SchedulerTest, |
1485 SyntheticBeginFrames_And_VSyncThrottlingDisabled_SwapThrottled) { | 1516 SyntheticBeginFrames_And_VSyncThrottlingDisabled_SwapThrottled) { |
1486 bool begin_frame_scheduling_enabled = false; | 1517 bool begin_frame_scheduling_enabled = false; |
1487 bool throttle_frame_production = false; | 1518 bool throttle_frame_production = false; |
1488 BeginFramesNotFromClient_SwapThrottled(begin_frame_scheduling_enabled, | 1519 BeginFramesNotFromClient_SwapThrottled(begin_frame_scheduling_enabled, |
1489 throttle_frame_production); | 1520 throttle_frame_production); |
1490 } | 1521 } |
1491 | 1522 |
1492 } // namespace | 1523 } // namespace |
1493 } // namespace cc | 1524 } // namespace cc |
OLD | NEW |