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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 209 } |
210 | 210 |
211 virtual void DidBeginImplFrameDeadline() OVERRIDE {} | 211 virtual void DidBeginImplFrameDeadline() OVERRIDE {} |
212 | 212 |
213 base::Callback<bool(void)> ImplFrameDeadlinePending(bool state) { | 213 base::Callback<bool(void)> ImplFrameDeadlinePending(bool state) { |
214 return base::Bind(&FakeSchedulerClient::ImplFrameDeadlinePendingCallback, | 214 return base::Bind(&FakeSchedulerClient::ImplFrameDeadlinePendingCallback, |
215 base::Unretained(this), | 215 base::Unretained(this), |
216 state); | 216 state); |
217 } | 217 } |
218 | 218 |
| 219 virtual void SendBeginFrameToChildren(const BeginFrameArgs& args) OVERRIDE {} |
| 220 |
219 protected: | 221 protected: |
220 bool ImplFrameDeadlinePendingCallback(bool state) { | 222 bool ImplFrameDeadlinePendingCallback(bool state) { |
221 return scheduler_->BeginImplFrameDeadlinePending() == state; | 223 return scheduler_->BeginImplFrameDeadlinePending() == state; |
222 } | 224 } |
223 | 225 |
224 bool needs_begin_frame_; | 226 bool needs_begin_frame_; |
225 bool draw_will_happen_; | 227 bool draw_will_happen_; |
226 bool swap_will_happen_if_draw_happens_; | 228 bool swap_will_happen_if_draw_happens_; |
227 bool automatic_swap_ack_; | 229 bool automatic_swap_ack_; |
228 int num_draws_; | 230 int num_draws_; |
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); | 1341 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); |
1340 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 1342 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
1341 EXPECT_TRUE(client.needs_begin_frame()); | 1343 EXPECT_TRUE(client.needs_begin_frame()); |
1342 client.Reset(); | 1344 client.Reset(); |
1343 } | 1345 } |
1344 | 1346 |
1345 void BeginFramesNotFromClient(bool begin_frame_scheduling_enabled, | 1347 void BeginFramesNotFromClient(bool begin_frame_scheduling_enabled, |
1346 bool throttle_frame_production) { | 1348 bool throttle_frame_production) { |
1347 FakeSchedulerClient client; | 1349 FakeSchedulerClient client; |
1348 SchedulerSettings scheduler_settings; | 1350 SchedulerSettings scheduler_settings; |
1349 scheduler_settings.begin_frame_scheduling_enabled = | 1351 // scheduler_settings.begin_frame_scheduling_enabled = |
1350 begin_frame_scheduling_enabled; | 1352 // begin_frame_scheduling_enabled; |
1351 scheduler_settings.throttle_frame_production = throttle_frame_production; | 1353 scheduler_settings.throttle_frame_production = throttle_frame_production; |
1352 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings); | 1354 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings); |
1353 scheduler->SetCanStart(); | 1355 scheduler->SetCanStart(); |
1354 scheduler->SetVisible(true); | 1356 scheduler->SetVisible(true); |
1355 scheduler->SetCanDraw(true); | 1357 scheduler->SetCanDraw(true); |
1356 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); | 1358 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
1357 | 1359 |
1358 // SetNeedsCommit should begin the frame on the next BeginImplFrame | 1360 // SetNeedsCommit should begin the frame on the next BeginImplFrame |
1359 // without calling SetNeedsBeginFrame. | 1361 // without calling SetNeedsBeginFrame. |
1360 client.Reset(); | 1362 client.Reset(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1434 bool begin_frame_scheduling_enabled = false; | 1436 bool begin_frame_scheduling_enabled = false; |
1435 bool throttle_frame_production = false; | 1437 bool throttle_frame_production = false; |
1436 BeginFramesNotFromClient(begin_frame_scheduling_enabled, | 1438 BeginFramesNotFromClient(begin_frame_scheduling_enabled, |
1437 throttle_frame_production); | 1439 throttle_frame_production); |
1438 } | 1440 } |
1439 | 1441 |
1440 void BeginFramesNotFromClient_SwapThrottled(bool begin_frame_scheduling_enabled, | 1442 void BeginFramesNotFromClient_SwapThrottled(bool begin_frame_scheduling_enabled, |
1441 bool throttle_frame_production) { | 1443 bool throttle_frame_production) { |
1442 FakeSchedulerClient client; | 1444 FakeSchedulerClient client; |
1443 SchedulerSettings scheduler_settings; | 1445 SchedulerSettings scheduler_settings; |
1444 scheduler_settings.begin_frame_scheduling_enabled = | 1446 // scheduler_settings.begin_frame_scheduling_enabled = |
1445 begin_frame_scheduling_enabled; | 1447 // begin_frame_scheduling_enabled; |
1446 scheduler_settings.throttle_frame_production = throttle_frame_production; | 1448 scheduler_settings.throttle_frame_production = throttle_frame_production; |
1447 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings); | 1449 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings); |
1448 scheduler->SetCanStart(); | 1450 scheduler->SetCanStart(); |
1449 scheduler->SetVisible(true); | 1451 scheduler->SetVisible(true); |
1450 scheduler->SetCanDraw(true); | 1452 scheduler->SetCanDraw(true); |
1451 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); | 1453 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
1452 | 1454 |
1453 // To test swap ack throttling, this test disables automatic swap acks. | 1455 // To test swap ack throttling, this test disables automatic swap acks. |
1454 scheduler->SetMaxSwapsPending(1); | 1456 scheduler->SetMaxSwapsPending(1); |
1455 client.SetAutomaticSwapAck(false); | 1457 client.SetAutomaticSwapAck(false); |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1904 EXPECT_FALSE(scheduler->IsSyntheticBeginFrameSourceActive()); | 1906 EXPECT_FALSE(scheduler->IsSyntheticBeginFrameSourceActive()); |
1905 | 1907 |
1906 client.Reset(); | 1908 client.Reset(); |
1907 client.task_runner().RunPendingTasks(); // Run posted deadline. | 1909 client.task_runner().RunPendingTasks(); // Run posted deadline. |
1908 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); | 1910 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); |
1909 EXPECT_FALSE(scheduler->IsSyntheticBeginFrameSourceActive()); | 1911 EXPECT_FALSE(scheduler->IsSyntheticBeginFrameSourceActive()); |
1910 } | 1912 } |
1911 | 1913 |
1912 } // namespace | 1914 } // namespace |
1913 } // namespace cc | 1915 } // namespace cc |
OLD | NEW |