| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 EXPECT_TRUE(client.needs_begin_impl_frame()); | 322 EXPECT_TRUE(client.needs_begin_impl_frame()); |
| 323 client.Reset(); | 323 client.Reset(); |
| 324 | 324 |
| 325 // Now SetNeedsCommit again. Calling here means we need a second commit. | 325 // Now SetNeedsCommit again. Calling here means we need a second commit. |
| 326 scheduler->SetNeedsCommit(); | 326 scheduler->SetNeedsCommit(); |
| 327 EXPECT_EQ(client.num_actions_(), 0); | 327 EXPECT_EQ(client.num_actions_(), 0); |
| 328 client.Reset(); | 328 client.Reset(); |
| 329 | 329 |
| 330 // Finish the first commit. | 330 // Finish the first commit. |
| 331 scheduler->FinishCommit(); | 331 scheduler->FinishCommit(); |
| 332 EXPECT_ACTION("ScheduledActionCommit", client, 0, 2); | 332 if (deadline_scheduling_enabled) { |
| 333 EXPECT_ACTION("PostBeginImplFrameDeadlineTask", client, 1, 2); | 333 EXPECT_ACTION("ScheduledActionCommit", client, 0, 2); |
| 334 EXPECT_ACTION("PostBeginImplFrameDeadlineTask", client, 1, 2); |
| 335 } else { |
| 336 EXPECT_ACTION("ScheduledActionCommit", client, 0, 3); |
| 337 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 3); |
| 338 EXPECT_ACTION("PostBeginImplFrameDeadlineTask", client, 2, 3); |
| 339 } |
| 334 client.Reset(); | 340 client.Reset(); |
| 335 scheduler->OnBeginImplFrameDeadline(); | 341 scheduler->OnBeginImplFrameDeadline(); |
| 336 if (deadline_scheduling_enabled) { | 342 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2); |
| 337 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2); | 343 EXPECT_ACTION("SetNeedsBeginImplFrame", client, 1, 2); |
| 338 EXPECT_ACTION("SetNeedsBeginImplFrame", client, 1, 2); | |
| 339 } else { | |
| 340 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 3); | |
| 341 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 3); | |
| 342 EXPECT_ACTION("SetNeedsBeginImplFrame", client, 2, 3); | |
| 343 } | |
| 344 | 344 |
| 345 // Because we just swapped, the Scheduler should also request the next | 345 // Because we just swapped, the Scheduler should also request the next |
| 346 // BeginImplFrame from the OutputSurface. | 346 // BeginImplFrame from the OutputSurface. |
| 347 EXPECT_TRUE(client.needs_begin_impl_frame()); | 347 EXPECT_TRUE(client.needs_begin_impl_frame()); |
| 348 client.Reset(); | 348 client.Reset(); |
| 349 | 349 |
| 350 // Since another commit is needed, the next BeginImplFrame should initiate | 350 // Since another commit is needed, the next BeginImplFrame should initiate |
| 351 // the second commit. | 351 // the second commit. |
| 352 scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting()); | 352 scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting()); |
| 353 if (deadline_scheduling_enabled) { | 353 if (deadline_scheduling_enabled) { |
| (...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1334 SpinForMillis(interval * 2); | 1334 SpinForMillis(interval * 2); |
| 1335 EXPECT_GT(client.num_actions_(), actions_so_far); | 1335 EXPECT_GT(client.num_actions_(), actions_so_far); |
| 1336 EXPECT_STREQ(client.Action(client.num_actions_() - 1), | 1336 EXPECT_STREQ(client.Action(client.num_actions_() - 1), |
| 1337 "DidAnticipatedDrawTimeChange"); | 1337 "DidAnticipatedDrawTimeChange"); |
| 1338 actions_so_far = client.num_actions_(); | 1338 actions_so_far = client.num_actions_(); |
| 1339 } | 1339 } |
| 1340 } | 1340 } |
| 1341 | 1341 |
| 1342 } // namespace | 1342 } // namespace |
| 1343 } // namespace cc | 1343 } // namespace cc |
| OLD | NEW |