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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 161 |
162 base::PowerMonitor* PowerMonitor() { return &power_monitor_; } | 162 base::PowerMonitor* PowerMonitor() { return &power_monitor_; } |
163 | 163 |
164 FakePowerMonitorSource* PowerMonitorSource() { | 164 FakePowerMonitorSource* PowerMonitorSource() { |
165 return fake_power_monitor_source_; | 165 return fake_power_monitor_source_; |
166 } | 166 } |
167 | 167 |
168 void AdvanceFrame() { | 168 void AdvanceFrame() { |
169 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.frames"), | 169 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.frames"), |
170 "FakeSchedulerClient::AdvanceFrame"); | 170 "FakeSchedulerClient::AdvanceFrame"); |
| 171 bool previous_deadline_pending = |
| 172 scheduler_->BeginImplFrameDeadlinePending(); |
171 if (ExternalBeginFrame()) { | 173 if (ExternalBeginFrame()) { |
172 // Creep the time forward so that any BeginFrameArgs is not equal to the | 174 SendNextBeginFrame(); |
173 // last one otherwise we violate the BeginFrameSource contract. | 175 // This could be the previous deadline or a new one. |
174 now_src_->AdvanceNowMicroseconds(1); | |
175 fake_external_begin_frame_source_->TestOnBeginFrame( | |
176 CreateBeginFrameArgsForTesting(now_src_)); | |
177 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 176 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
178 } | 177 } |
179 | 178 // Consume previous deadline first. It is important that we check for the |
| 179 // existence of a previous deadline so that we do not consume the new one. |
| 180 if (previous_deadline_pending) { |
| 181 EXPECT_TRUE(task_runner().RunTasksWhile(ImplFrameDeadlinePending(true))); |
| 182 } |
| 183 // Then run tasks until new deadline is scheduled. |
180 EXPECT_TRUE(task_runner().RunTasksWhile(ImplFrameDeadlinePending(false))); | 184 EXPECT_TRUE(task_runner().RunTasksWhile(ImplFrameDeadlinePending(false))); |
181 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 185 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
182 } | 186 } |
183 | 187 |
| 188 void SendNextBeginFrame() { |
| 189 DCHECK(ExternalBeginFrame()); |
| 190 // Creep the time forward so that any BeginFrameArgs is not equal to the |
| 191 // last one otherwise we violate the BeginFrameSource contract. |
| 192 now_src_->AdvanceNow(BeginFrameArgs::DefaultInterval()); |
| 193 fake_external_begin_frame_source_->TestOnBeginFrame( |
| 194 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now_src_)); |
| 195 } |
| 196 |
184 OrderedSimpleTaskRunner& task_runner() { return *task_runner_; } | 197 OrderedSimpleTaskRunner& task_runner() { return *task_runner_; } |
185 TestNowSource* now_src() { return now_src_.get(); } | 198 TestNowSource* now_src() { return now_src_.get(); } |
186 | 199 |
187 int ActionIndex(const char* action) const { | 200 int ActionIndex(const char* action) const { |
188 for (size_t i = 0; i < actions_.size(); i++) | 201 for (size_t i = 0; i < actions_.size(); i++) |
189 if (!strcmp(actions_[i], action)) | 202 if (!strcmp(actions_[i], action)) |
190 return i; | 203 return i; |
191 return -1; | 204 return -1; |
192 } | 205 } |
193 | 206 |
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 scheduler->SetCanStart(); | 1173 scheduler->SetCanStart(); |
1161 scheduler->SetVisible(true); | 1174 scheduler->SetVisible(true); |
1162 scheduler->DidCreateAndInitializeOutputSurface(); | 1175 scheduler->DidCreateAndInitializeOutputSurface(); |
1163 | 1176 |
1164 scheduler->SetNeedsCommit(); | 1177 scheduler->SetNeedsCommit(); |
1165 EXPECT_TRUE(scheduler->CommitPending()); | 1178 EXPECT_TRUE(scheduler->CommitPending()); |
1166 scheduler->NotifyBeginMainFrameStarted(); | 1179 scheduler->NotifyBeginMainFrameStarted(); |
1167 scheduler->NotifyReadyToCommit(); | 1180 scheduler->NotifyReadyToCommit(); |
1168 scheduler->SetNeedsRedraw(); | 1181 scheduler->SetNeedsRedraw(); |
1169 | 1182 |
1170 BeginFrameArgs frame_args = CreateBeginFrameArgsForTesting(client.now_src()); | 1183 BeginFrameArgs frame_args = |
| 1184 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, client.now_src()); |
1171 frame_args.interval = base::TimeDelta::FromMilliseconds(1000); | 1185 frame_args.interval = base::TimeDelta::FromMilliseconds(1000); |
1172 client.fake_external_begin_frame_source()->TestOnBeginFrame(frame_args); | 1186 client.fake_external_begin_frame_source()->TestOnBeginFrame(frame_args); |
1173 | 1187 |
1174 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1188 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1175 client.task_runner().RunPendingTasks(); // Run posted deadline. | 1189 client.task_runner().RunPendingTasks(); // Run posted deadline. |
1176 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 1190 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
1177 | 1191 |
1178 scheduler->DidSwapBuffers(); | 1192 scheduler->DidSwapBuffers(); |
1179 scheduler->DidSwapBuffersComplete(); | 1193 scheduler->DidSwapBuffersComplete(); |
1180 | 1194 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); | 1247 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
1234 | 1248 |
1235 // SetNeedsCommit should begin the frame on the next BeginImplFrame. | 1249 // SetNeedsCommit should begin the frame on the next BeginImplFrame. |
1236 client.Reset(); | 1250 client.Reset(); |
1237 scheduler->SetNeedsCommit(); | 1251 scheduler->SetNeedsCommit(); |
1238 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); | 1252 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); |
1239 client.Reset(); | 1253 client.Reset(); |
1240 | 1254 |
1241 // Create a BeginFrame with a long deadline to avoid race conditions. | 1255 // Create a BeginFrame with a long deadline to avoid race conditions. |
1242 // This is the first BeginFrame, which will be handled immediately. | 1256 // This is the first BeginFrame, which will be handled immediately. |
1243 BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.now_src()); | 1257 BeginFrameArgs args = |
| 1258 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, client.now_src()); |
1244 args.deadline += base::TimeDelta::FromHours(1); | 1259 args.deadline += base::TimeDelta::FromHours(1); |
1245 client.fake_external_begin_frame_source()->TestOnBeginFrame(args); | 1260 client.fake_external_begin_frame_source()->TestOnBeginFrame(args); |
1246 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 1261 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
1247 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | 1262 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
1248 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1263 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1249 EXPECT_TRUE(client.needs_begin_frames()); | 1264 EXPECT_TRUE(client.needs_begin_frames()); |
1250 client.Reset(); | 1265 client.Reset(); |
1251 | 1266 |
1252 // Queue BeginFrames while we are still handling the previous BeginFrame. | 1267 // Queue BeginFrames while we are still handling the previous BeginFrame. |
1253 args.frame_time += base::TimeDelta::FromSeconds(1); | 1268 args.frame_time += base::TimeDelta::FromSeconds(1); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 client.SetAutomaticSwapAck(false); | 1326 client.SetAutomaticSwapAck(false); |
1312 | 1327 |
1313 // SetNeedsCommit should begin the frame on the next BeginImplFrame. | 1328 // SetNeedsCommit should begin the frame on the next BeginImplFrame. |
1314 client.Reset(); | 1329 client.Reset(); |
1315 scheduler->SetNeedsCommit(); | 1330 scheduler->SetNeedsCommit(); |
1316 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); | 1331 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); |
1317 client.Reset(); | 1332 client.Reset(); |
1318 | 1333 |
1319 // Create a BeginFrame with a long deadline to avoid race conditions. | 1334 // Create a BeginFrame with a long deadline to avoid race conditions. |
1320 // This is the first BeginFrame, which will be handled immediately. | 1335 // This is the first BeginFrame, which will be handled immediately. |
1321 BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.now_src()); | 1336 BeginFrameArgs args = |
| 1337 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, client.now_src()); |
1322 args.deadline += base::TimeDelta::FromHours(1); | 1338 args.deadline += base::TimeDelta::FromHours(1); |
1323 client.fake_external_begin_frame_source()->TestOnBeginFrame(args); | 1339 client.fake_external_begin_frame_source()->TestOnBeginFrame(args); |
1324 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 1340 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
1325 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | 1341 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
1326 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1342 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1327 EXPECT_TRUE(client.needs_begin_frames()); | 1343 EXPECT_TRUE(client.needs_begin_frames()); |
1328 client.Reset(); | 1344 client.Reset(); |
1329 | 1345 |
1330 // Queue BeginFrame while we are still handling the previous BeginFrame. | 1346 // Queue BeginFrame while we are still handling the previous BeginFrame. |
1331 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1347 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 EXPECT_TRUE(client.task_runner().RunTasksWhile( | 1396 EXPECT_TRUE(client.task_runner().RunTasksWhile( |
1381 client.ImplFrameDeadlinePending(true))); | 1397 client.ImplFrameDeadlinePending(true))); |
1382 | 1398 |
1383 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2); | 1399 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2); |
1384 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); | 1400 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); |
1385 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 1401 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
1386 EXPECT_TRUE(client.needs_begin_frames()); | 1402 EXPECT_TRUE(client.needs_begin_frames()); |
1387 client.Reset(); | 1403 client.Reset(); |
1388 } | 1404 } |
1389 | 1405 |
| 1406 TEST(SchedulerTest, RetroFrameDoesNotExpireTooEarly) { |
| 1407 FakeSchedulerClient client; |
| 1408 SchedulerSettings scheduler_settings; |
| 1409 scheduler_settings.use_external_begin_frame_source = true; |
| 1410 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings); |
| 1411 scheduler->SetCanStart(); |
| 1412 scheduler->SetVisible(true); |
| 1413 scheduler->SetCanDraw(true); |
| 1414 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
| 1415 |
| 1416 client.Reset(); |
| 1417 scheduler->SetNeedsCommit(); |
| 1418 EXPECT_TRUE(client.needs_begin_frames()); |
| 1419 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); |
| 1420 |
| 1421 client.Reset(); |
| 1422 client.AdvanceFrame(); |
| 1423 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| 1424 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
| 1425 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| 1426 |
| 1427 client.Reset(); |
| 1428 scheduler->NotifyBeginMainFrameStarted(); |
| 1429 |
| 1430 client.Reset(); |
| 1431 client.SendNextBeginFrame(); |
| 1432 // This BeginFrame is queued up as a retro frame. |
| 1433 EXPECT_NO_ACTION(client); |
| 1434 // The previous deadline is still pending. |
| 1435 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| 1436 |
| 1437 client.Reset(); |
| 1438 // This commit should schedule the (previous) deadline to trigger immediately. |
| 1439 scheduler->NotifyReadyToCommit(); |
| 1440 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); |
| 1441 |
| 1442 client.Reset(); |
| 1443 // The deadline task should trigger causing a draw. |
| 1444 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| 1445 client.task_runner().RunTasksWhile(client.ImplFrameDeadlinePending(true)); |
| 1446 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2); |
| 1447 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); |
| 1448 |
| 1449 // Keep animating. |
| 1450 client.Reset(); |
| 1451 scheduler->SetNeedsAnimate(); |
| 1452 scheduler->SetNeedsRedraw(); |
| 1453 EXPECT_NO_ACTION(client); |
| 1454 |
| 1455 // Let's advance sufficiently past the next frame's deadline. |
| 1456 client.now_src()->AdvanceNow( |
| 1457 BeginFrameArgs::DefaultInterval() - |
| 1458 BeginFrameArgs::DefaultEstimatedParentDrawTime() + |
| 1459 base::TimeDelta::FromMicroseconds(1)); |
| 1460 |
| 1461 // The retro frame hasn't expired yet. |
| 1462 client.task_runner().RunTasksWhile(client.ImplFrameDeadlinePending(false)); |
| 1463 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| 1464 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
| 1465 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| 1466 |
| 1467 // This is an immediate deadline case. |
| 1468 client.Reset(); |
| 1469 client.task_runner().RunPendingTasks(); |
| 1470 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
| 1471 EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client); |
| 1472 } |
| 1473 |
| 1474 TEST(SchedulerTest, RetroFrameDoesNotExpireTooLate) { |
| 1475 FakeSchedulerClient client; |
| 1476 SchedulerSettings scheduler_settings; |
| 1477 scheduler_settings.use_external_begin_frame_source = true; |
| 1478 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings); |
| 1479 scheduler->SetCanStart(); |
| 1480 scheduler->SetVisible(true); |
| 1481 scheduler->SetCanDraw(true); |
| 1482 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
| 1483 |
| 1484 client.Reset(); |
| 1485 scheduler->SetNeedsCommit(); |
| 1486 EXPECT_TRUE(client.needs_begin_frames()); |
| 1487 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); |
| 1488 |
| 1489 client.Reset(); |
| 1490 client.AdvanceFrame(); |
| 1491 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| 1492 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
| 1493 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| 1494 |
| 1495 client.Reset(); |
| 1496 scheduler->NotifyBeginMainFrameStarted(); |
| 1497 |
| 1498 client.Reset(); |
| 1499 client.SendNextBeginFrame(); |
| 1500 // This BeginFrame is queued up as a retro frame. |
| 1501 EXPECT_NO_ACTION(client); |
| 1502 // The previous deadline is still pending. |
| 1503 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| 1504 |
| 1505 client.Reset(); |
| 1506 // This commit should schedule the (previous) deadline to trigger immediately. |
| 1507 scheduler->NotifyReadyToCommit(); |
| 1508 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); |
| 1509 |
| 1510 client.Reset(); |
| 1511 // The deadline task should trigger causing a draw. |
| 1512 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| 1513 client.task_runner().RunTasksWhile(client.ImplFrameDeadlinePending(true)); |
| 1514 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2); |
| 1515 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); |
| 1516 |
| 1517 // Keep animating. |
| 1518 client.Reset(); |
| 1519 scheduler->SetNeedsAnimate(); |
| 1520 scheduler->SetNeedsRedraw(); |
| 1521 EXPECT_NO_ACTION(client); |
| 1522 |
| 1523 // Let's advance sufficiently past the next frame's deadline. |
| 1524 client.now_src()->AdvanceNow(BeginFrameArgs::DefaultInterval() + |
| 1525 base::TimeDelta::FromMicroseconds(1)); |
| 1526 |
| 1527 // The retro frame should've expired. |
| 1528 EXPECT_NO_ACTION(client); |
| 1529 } |
| 1530 |
1390 void BeginFramesNotFromClient(bool use_external_begin_frame_source, | 1531 void BeginFramesNotFromClient(bool use_external_begin_frame_source, |
1391 bool throttle_frame_production) { | 1532 bool throttle_frame_production) { |
1392 FakeSchedulerClient client; | 1533 FakeSchedulerClient client; |
1393 SchedulerSettings scheduler_settings; | 1534 SchedulerSettings scheduler_settings; |
1394 scheduler_settings.use_external_begin_frame_source = | 1535 scheduler_settings.use_external_begin_frame_source = |
1395 use_external_begin_frame_source; | 1536 use_external_begin_frame_source; |
1396 scheduler_settings.throttle_frame_production = throttle_frame_production; | 1537 scheduler_settings.throttle_frame_production = throttle_frame_production; |
1397 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings); | 1538 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings); |
1398 scheduler->SetCanStart(); | 1539 scheduler->SetCanStart(); |
1399 scheduler->SetVisible(true); | 1540 scheduler->SetVisible(true); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1786 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); | 1927 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
1787 | 1928 |
1788 // SetNeedsCommit should begin the frame on the next BeginImplFrame. | 1929 // SetNeedsCommit should begin the frame on the next BeginImplFrame. |
1789 client.Reset(); | 1930 client.Reset(); |
1790 scheduler->SetNeedsCommit(); | 1931 scheduler->SetNeedsCommit(); |
1791 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); | 1932 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); |
1792 | 1933 |
1793 // Create a BeginFrame with a long deadline to avoid race conditions. | 1934 // Create a BeginFrame with a long deadline to avoid race conditions. |
1794 // This is the first BeginFrame, which will be handled immediately. | 1935 // This is the first BeginFrame, which will be handled immediately. |
1795 client.Reset(); | 1936 client.Reset(); |
1796 BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.now_src()); | 1937 BeginFrameArgs args = |
| 1938 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, client.now_src()); |
1797 args.deadline += base::TimeDelta::FromHours(1); | 1939 args.deadline += base::TimeDelta::FromHours(1); |
1798 client.fake_external_begin_frame_source()->TestOnBeginFrame(args); | 1940 client.fake_external_begin_frame_source()->TestOnBeginFrame(args); |
1799 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 1941 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
1800 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | 1942 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
1801 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1943 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1802 EXPECT_TRUE(client.needs_begin_frames()); | 1944 EXPECT_TRUE(client.needs_begin_frames()); |
1803 | 1945 |
1804 // Queue BeginFrames while we are still handling the previous BeginFrame. | 1946 // Queue BeginFrames while we are still handling the previous BeginFrame. |
1805 args.frame_time += base::TimeDelta::FromSeconds(1); | 1947 args.frame_time += base::TimeDelta::FromSeconds(1); |
1806 client.fake_external_begin_frame_source()->TestOnBeginFrame(args); | 1948 client.fake_external_begin_frame_source()->TestOnBeginFrame(args); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1845 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); | 1987 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
1846 | 1988 |
1847 // SetNeedsCommit should begin the frame on the next BeginImplFrame. | 1989 // SetNeedsCommit should begin the frame on the next BeginImplFrame. |
1848 client.Reset(); | 1990 client.Reset(); |
1849 scheduler->SetNeedsCommit(); | 1991 scheduler->SetNeedsCommit(); |
1850 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); | 1992 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); |
1851 | 1993 |
1852 // Create a BeginFrame with a long deadline to avoid race conditions. | 1994 // Create a BeginFrame with a long deadline to avoid race conditions. |
1853 // This is the first BeginFrame, which will be handled immediately. | 1995 // This is the first BeginFrame, which will be handled immediately. |
1854 client.Reset(); | 1996 client.Reset(); |
1855 BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.now_src()); | 1997 BeginFrameArgs args = |
| 1998 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, client.now_src()); |
1856 args.deadline += base::TimeDelta::FromHours(1); | 1999 args.deadline += base::TimeDelta::FromHours(1); |
1857 client.fake_external_begin_frame_source()->TestOnBeginFrame(args); | 2000 client.fake_external_begin_frame_source()->TestOnBeginFrame(args); |
1858 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 2001 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
1859 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | 2002 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
1860 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 2003 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1861 EXPECT_TRUE(client.needs_begin_frames()); | 2004 EXPECT_TRUE(client.needs_begin_frames()); |
1862 | 2005 |
1863 // Queue BeginFrames while we are still handling the previous BeginFrame. | 2006 // Queue BeginFrames while we are still handling the previous BeginFrame. |
1864 args.frame_time += base::TimeDelta::FromSeconds(1); | 2007 args.frame_time += base::TimeDelta::FromSeconds(1); |
1865 client.fake_external_begin_frame_source()->TestOnBeginFrame(args); | 2008 client.fake_external_begin_frame_source()->TestOnBeginFrame(args); |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2128 | 2271 |
2129 // Deadline task is pending | 2272 // Deadline task is pending |
2130 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 2273 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
2131 client.task_runner().RunPendingTasks(); | 2274 client.task_runner().RunPendingTasks(); |
2132 // Deadline task runs immediately | 2275 // Deadline task runs immediately |
2133 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 2276 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
2134 } | 2277 } |
2135 | 2278 |
2136 } // namespace | 2279 } // namespace |
2137 } // namespace cc | 2280 } // namespace cc |
OLD | NEW |