Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: cc/scheduler/scheduler_unittest.cc

Issue 267783004: Refactoring the way begin frame sources inside scheduler work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Scheduler tests now pass and the code is cleaner. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | cc/scheduler/time_source.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/test/test_simple_task_runner.h" 13 #include "base/test/test_simple_task_runner.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "cc/test/begin_frame_args_test.h" 15 #include "cc/test/begin_frame_args_test.h"
16 #include "cc/test/scheduler_test_common.h" 16 #include "cc/test/scheduler_test_common.h"
17 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 #define EXPECT_ACTION(action, client, action_index, expected_num_actions) \ 20 #define EXPECT_ACTION(action, client, action_index, expected_num_actions) \
21 EXPECT_EQ(expected_num_actions, client.num_actions_()); \ 21 EXPECT_EQ(expected_num_actions, client.num_actions_()); \
22 ASSERT_LT(action_index, client.num_actions_()); \ 22 ASSERT_LT(action_index, client.num_actions_()) << scheduler; \
23 do { \ 23 do { \
24 EXPECT_STREQ(action, client.Action(action_index)); \ 24 EXPECT_STREQ(action, client.Action(action_index)); \
25 for (int i = expected_num_actions; i < client.num_actions_(); ++i) \ 25 for (int i = expected_num_actions; i < client.num_actions_(); ++i) \
26 ADD_FAILURE() << "Unexpected action: " << client.Action(i) << \ 26 ADD_FAILURE() << "Unexpected action: " << client.Action(i) \
27 " with state:\n" << client.StateForAction(action_index); \ 27 << " with state:\n" \
28 << client.StateForAction(action_index); \
28 } while (false) 29 } while (false)
29 30
30 #define EXPECT_SINGLE_ACTION(action, client) \ 31 #define EXPECT_SINGLE_ACTION(action, client) \
31 EXPECT_ACTION(action, client, 0, 1) 32 EXPECT_ACTION(action, client, 0, 1)
32 33
33 namespace cc { 34 namespace cc {
34 namespace { 35 namespace {
35 36
36 class FakeSchedulerClient; 37 class FakeSchedulerClient;
37 38
38 void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler, 39 class FakeBeginFrameSource : public BaseBeginFrameSource {
39 FakeSchedulerClient* client); 40 public:
41 FakeSchedulerClient* fake_client_;
42
43 explicit FakeBeginFrameSource(FakeSchedulerClient* fake_client)
44 : BaseBeginFrameSource(0), fake_client_(fake_client) {}
45
46 virtual void OnGenerateChange(bool generate_frames) OVERRIDE;
47
48 virtual inline std::string TypeString() const OVERRIDE {
49 return "FakeBeginFrameSource";
50 }
51
52 void TestBeginFrame(BeginFrameArgs args) { frame_sink_->BeginFrame(args); }
53 };
40 54
41 class FakeSchedulerClient : public SchedulerClient { 55 class FakeSchedulerClient : public SchedulerClient {
42 public: 56 public:
43 FakeSchedulerClient() : needs_begin_frame_(false), automatic_swap_ack_(true) { 57 FakeSchedulerClient()
58 : generate_frames_(false),
59 automatic_swap_ack_(true),
60 frame_source_(this) {
44 Reset(); 61 Reset();
45 } 62 }
46 63
47 void Reset() { 64 void Reset() {
48 actions_.clear(); 65 actions_.clear();
49 states_.clear(); 66 states_.clear();
50 draw_will_happen_ = true; 67 draw_will_happen_ = true;
51 swap_will_happen_if_draw_happens_ = true; 68 swap_will_happen_if_draw_happens_ = true;
52 num_draws_ = 0; 69 num_draws_ = 0;
53 log_anticipated_draw_time_change_ = false; 70 log_anticipated_draw_time_change_ = false;
54 } 71 }
55 72
56 Scheduler* CreateScheduler(const SchedulerSettings& settings) { 73 Scheduler* CreateScheduler(const SchedulerSettings& settings) {
57 task_runner_ = new base::TestSimpleTaskRunner; 74 task_runner_ = new base::TestSimpleTaskRunner;
58 scheduler_ = Scheduler::Create(this, settings, 0, task_runner_); 75
76 scheduler_ =
77 Scheduler::Create(this,
78 settings,
79 0,
80 static_cast<BeginFrameSource*>(&frame_source_),
81 task_runner_);
59 return scheduler_.get(); 82 return scheduler_.get();
60 } 83 }
61 84
62 // Most tests don't care about DidAnticipatedDrawTimeChange, so only record it 85 // Most tests don't care about DidAnticipatedDrawTimeChange, so only record it
63 // for tests that do. 86 // for tests that do.
64 void set_log_anticipated_draw_time_change(bool log) { 87 void set_log_anticipated_draw_time_change(bool log) {
65 log_anticipated_draw_time_change_ = log; 88 log_anticipated_draw_time_change_ = log;
66 } 89 }
67 bool needs_begin_frame() { return needs_begin_frame_; } 90 bool generate_frames() { return generate_frames_; }
68 int num_draws() const { return num_draws_; } 91 int num_draws() const { return num_draws_; }
69 int num_actions_() const { return static_cast<int>(actions_.size()); } 92 int num_actions_() const { return static_cast<int>(actions_.size()); }
70 const char* Action(int i) const { return actions_[i]; } 93 const char* Action(int i) const { return actions_[i]; }
71 base::Value& StateForAction(int i) const { return *states_[i]; } 94 base::Value& StateForAction(int i) const { return *states_[i]; }
72 base::TimeTicks posted_begin_impl_frame_deadline() const { 95 base::TimeTicks posted_begin_impl_frame_deadline() const {
73 return posted_begin_impl_frame_deadline_; 96 return posted_begin_impl_frame_deadline_;
74 } 97 }
75 98
76 base::TestSimpleTaskRunner& task_runner() { return *task_runner_; } 99 base::TestSimpleTaskRunner& task_runner() { return *task_runner_; }
77 100
(...skipping 12 matching lines...) Expand all
90 draw_will_happen_ = draw_will_happen; 113 draw_will_happen_ = draw_will_happen;
91 } 114 }
92 void SetSwapWillHappenIfDrawHappens(bool swap_will_happen_if_draw_happens) { 115 void SetSwapWillHappenIfDrawHappens(bool swap_will_happen_if_draw_happens) {
93 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;
94 } 117 }
95 void SetAutomaticSwapAck(bool automatic_swap_ack) { 118 void SetAutomaticSwapAck(bool automatic_swap_ack) {
96 automatic_swap_ack_ = automatic_swap_ack; 119 automatic_swap_ack_ = automatic_swap_ack;
97 } 120 }
98 121
99 // SchedulerClient implementation. 122 // SchedulerClient implementation.
100 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE {
101 actions_.push_back("SetNeedsBeginFrame");
102 states_.push_back(scheduler_->AsValue().release());
103 needs_begin_frame_ = enable;
104 }
105 virtual void WillBeginImplFrame(const BeginFrameArgs& args) OVERRIDE { 123 virtual void WillBeginImplFrame(const BeginFrameArgs& args) OVERRIDE {
106 actions_.push_back("WillBeginImplFrame"); 124 actions_.push_back("WillBeginImplFrame");
107 states_.push_back(scheduler_->AsValue().release()); 125 states_.push_back(scheduler_->AsValue().release());
108 } 126 }
109 virtual void ScheduledActionSendBeginMainFrame() OVERRIDE { 127 virtual void ScheduledActionSendBeginMainFrame() OVERRIDE {
110 actions_.push_back("ScheduledActionSendBeginMainFrame"); 128 actions_.push_back("ScheduledActionSendBeginMainFrame");
111 states_.push_back(scheduler_->AsValue().release()); 129 states_.push_back(scheduler_->AsValue().release());
112 } 130 }
113 virtual void ScheduledActionAnimate() OVERRIDE { 131 virtual void ScheduledActionAnimate() OVERRIDE {
114 actions_.push_back("ScheduledActionAnimate"); 132 actions_.push_back("ScheduledActionAnimate");
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } 181 }
164 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() OVERRIDE { 182 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() OVERRIDE {
165 return base::TimeDelta(); 183 return base::TimeDelta();
166 } 184 }
167 virtual base::TimeDelta CommitToActivateDurationEstimate() OVERRIDE { 185 virtual base::TimeDelta CommitToActivateDurationEstimate() OVERRIDE {
168 return base::TimeDelta(); 186 return base::TimeDelta();
169 } 187 }
170 188
171 virtual void DidBeginImplFrameDeadline() OVERRIDE {} 189 virtual void DidBeginImplFrameDeadline() OVERRIDE {}
172 190
191 FakeBeginFrameSource& frame_source() { return frame_source_; }
192
173 protected: 193 protected:
174 bool needs_begin_frame_; 194 bool generate_frames_;
175 bool draw_will_happen_; 195 bool draw_will_happen_;
176 bool swap_will_happen_if_draw_happens_; 196 bool swap_will_happen_if_draw_happens_;
177 bool automatic_swap_ack_; 197 bool automatic_swap_ack_;
178 int num_draws_; 198 int num_draws_;
179 bool log_anticipated_draw_time_change_; 199 bool log_anticipated_draw_time_change_;
180 base::TimeTicks posted_begin_impl_frame_deadline_; 200 base::TimeTicks posted_begin_impl_frame_deadline_;
181 std::vector<const char*> actions_; 201 std::vector<const char*> actions_;
182 ScopedVector<base::Value> states_; 202 ScopedVector<base::Value> states_;
183 scoped_ptr<Scheduler> scheduler_; 203 scoped_ptr<Scheduler> scheduler_;
184 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; 204 scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
205
206 friend class FakeBeginFrameSource;
207 FakeBeginFrameSource frame_source_;
185 }; 208 };
186 209
210 void FakeBeginFrameSource::OnGenerateChange(bool generate_frames) {
211 fake_client_->actions_.push_back("SetGenerateFrames");
212 fake_client_->states_.push_back(
213 fake_client_->scheduler_->AsValue().release());
214 fake_client_->generate_frames_ = generate_frames;
215 }
216
187 void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler, 217 void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler,
188 FakeSchedulerClient* client) { 218 FakeSchedulerClient* client) {
189 bool client_initiates_begin_frame = 219 bool client_initiates_begin_frame =
190 scheduler->settings().begin_frame_scheduling_enabled && 220 scheduler->settings().begin_frame_scheduling_enabled &&
191 scheduler->settings().throttle_frame_production; 221 scheduler->settings().throttle_frame_production;
192 222
193 scheduler->DidCreateAndInitializeOutputSurface(); 223 scheduler->DidCreateAndInitializeOutputSurface();
194 scheduler->SetNeedsCommit(); 224 scheduler->SetNeedsCommit();
195 scheduler->NotifyBeginMainFrameStarted(); 225 scheduler->NotifyBeginMainFrameStarted();
196 scheduler->NotifyReadyToCommit(); 226 scheduler->NotifyReadyToCommit();
197 // Go through the motions to draw the commit. 227 // Go through the motions to draw the commit.
198 if (client_initiates_begin_frame) 228 if (client_initiates_begin_frame)
199 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 229 client->frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
200 else 230 else
201 client->task_runner().RunPendingTasks(); // Run posted BeginFrame. 231 client->task_runner().RunPendingTasks(); // Run posted BeginFrame.
202 232
203 // Run the posted deadline task. 233 // Run the posted deadline task.
204 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 234 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
205 client->task_runner().RunPendingTasks(); 235 client->task_runner().RunPendingTasks();
206 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 236 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
207 237
238 // EXPECT_TRUE(client->generate_frames());
239
208 // We need another BeginImplFrame so Scheduler calls 240 // We need another BeginImplFrame so Scheduler calls
209 // SetNeedsBeginFrame(false). 241 // SetGenerateFrames(false).
210 if (client_initiates_begin_frame) 242 if (client_initiates_begin_frame)
211 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 243 client->frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
212 else 244 else
213 client->task_runner().RunPendingTasks(); // Run posted BeginFrame. 245 client->task_runner().RunPendingTasks(); // Run posted BeginFrame.
214 246
247 // EXPECT_FALSE(client->generate_frames());
248
215 // Run the posted deadline task. 249 // Run the posted deadline task.
216 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 250 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
217 client->task_runner().RunPendingTasks(); 251 client->task_runner().RunPendingTasks();
218 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 252 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
219 } 253 }
220 254
221 TEST(SchedulerTest, InitializeOutputSurfaceDoesNotBeginImplFrame) { 255 TEST(SchedulerTest, InitializeOutputSurfaceDoesNotBeginImplFrame) {
222 FakeSchedulerClient client; 256 FakeSchedulerClient client;
223 SchedulerSettings default_scheduler_settings; 257 SchedulerSettings default_scheduler_settings;
224 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 258 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings);
(...skipping 14 matching lines...) Expand all
239 scheduler->SetCanStart(); 273 scheduler->SetCanStart();
240 scheduler->SetVisible(true); 274 scheduler->SetVisible(true);
241 scheduler->SetCanDraw(true); 275 scheduler->SetCanDraw(true);
242 276
243 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); 277 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client);
244 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); 278 InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
245 279
246 // SetNeedsCommit should begin the frame on the next BeginImplFrame. 280 // SetNeedsCommit should begin the frame on the next BeginImplFrame.
247 client.Reset(); 281 client.Reset();
248 scheduler->SetNeedsCommit(); 282 scheduler->SetNeedsCommit();
249 EXPECT_TRUE(client.needs_begin_frame()); 283 EXPECT_TRUE(client.generate_frames());
250 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); 284 EXPECT_SINGLE_ACTION("SetGenerateFrames", client);
251 client.Reset(); 285 client.Reset();
252 286
253 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 287 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
254 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 288 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
255 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); 289 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
256 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 290 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
257 EXPECT_TRUE(client.needs_begin_frame()); 291 EXPECT_TRUE(client.generate_frames());
258 client.Reset(); 292 client.Reset();
259 293
260 // If we don't swap on the deadline, we wait for the next BeginFrame. 294 // If we don't swap on the deadline, we wait for the next BeginFrame.
261 client.task_runner().RunPendingTasks(); // Run posted deadline. 295 client.task_runner().RunPendingTasks(); // Run posted deadline.
262 EXPECT_EQ(0, client.num_actions_()); 296 EXPECT_EQ(0, client.num_actions_());
263 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 297 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
264 EXPECT_TRUE(client.needs_begin_frame()); 298 EXPECT_TRUE(client.generate_frames());
265 client.Reset(); 299 client.Reset();
266 300
267 // NotifyReadyToCommit should trigger the commit. 301 // NotifyReadyToCommit should trigger the commit.
268 scheduler->NotifyBeginMainFrameStarted(); 302 scheduler->NotifyBeginMainFrameStarted();
269 scheduler->NotifyReadyToCommit(); 303 scheduler->NotifyReadyToCommit();
270 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); 304 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
271 EXPECT_TRUE(client.needs_begin_frame()); 305 EXPECT_TRUE(client.generate_frames());
272 client.Reset(); 306 client.Reset();
273 307
274 // BeginImplFrame should prepare the draw. 308 // BeginImplFrame should prepare the draw.
275 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 309 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
276 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 310 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
277 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); 311 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
278 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 312 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
279 EXPECT_TRUE(client.needs_begin_frame()); 313 EXPECT_TRUE(client.generate_frames());
280 client.Reset(); 314 client.Reset();
281 315
282 // BeginImplFrame deadline should draw. 316 // BeginImplFrame deadline should draw.
283 client.task_runner().RunPendingTasks(); // Run posted deadline. 317 client.task_runner().RunPendingTasks(); // Run posted deadline.
284 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); 318 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
285 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 319 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
286 EXPECT_TRUE(client.needs_begin_frame()); 320 EXPECT_TRUE(client.generate_frames());
287 client.Reset(); 321 client.Reset();
288 322
289 // The following BeginImplFrame deadline should SetNeedsBeginFrame(false) 323 // The following BeginImplFrame deadline should SetGenerateFrames(false)
290 // to avoid excessive toggles. 324 // to avoid excessive toggles.
291 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 325 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
292 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); 326 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client);
293 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 327 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
294 client.Reset(); 328 client.Reset();
295 329
296 client.task_runner().RunPendingTasks(); // Run posted deadline. 330 client.task_runner().RunPendingTasks(); // Run posted deadline.
297 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); 331 EXPECT_SINGLE_ACTION("SetGenerateFrames", client);
298 EXPECT_FALSE(client.needs_begin_frame()); 332 EXPECT_FALSE(client.generate_frames());
299 client.Reset(); 333 client.Reset();
300 } 334 }
301 335
302 TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) { 336 TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
303 FakeSchedulerClient client; 337 FakeSchedulerClient client;
304 SchedulerSettings scheduler_settings; 338 SchedulerSettings scheduler_settings;
305 Scheduler* scheduler = client.CreateScheduler(scheduler_settings); 339 Scheduler* scheduler = client.CreateScheduler(scheduler_settings);
306 scheduler->SetCanStart(); 340 scheduler->SetCanStart();
307 scheduler->SetVisible(true); 341 scheduler->SetVisible(true);
308 scheduler->SetCanDraw(true); 342 scheduler->SetCanDraw(true);
309 343
310 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); 344 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client);
311 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); 345 InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
312 client.Reset(); 346 client.Reset();
313 347
314 // SetNeedsCommit should begin the frame. 348 // SetNeedsCommit should begin the frame.
315 scheduler->SetNeedsCommit(); 349 scheduler->SetNeedsCommit();
316 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); 350 EXPECT_SINGLE_ACTION("SetGenerateFrames", client);
317 351
318 client.Reset(); 352 client.Reset();
319 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 353 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
320 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 354 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
321 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); 355 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
322 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 356 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
323 357
324 EXPECT_TRUE(client.needs_begin_frame()); 358 EXPECT_TRUE(client.generate_frames());
325 client.Reset(); 359 client.Reset();
326 360
327 // Now SetNeedsCommit again. Calling here means we need a second commit. 361 // Now SetNeedsCommit again. Calling here means we need a second commit.
328 scheduler->SetNeedsCommit(); 362 scheduler->SetNeedsCommit();
329 EXPECT_EQ(client.num_actions_(), 0); 363 EXPECT_EQ(client.num_actions_(), 0);
330 client.Reset(); 364 client.Reset();
331 365
332 // Finish the first commit. 366 // Finish the first commit.
333 scheduler->NotifyBeginMainFrameStarted(); 367 scheduler->NotifyBeginMainFrameStarted();
334 scheduler->NotifyReadyToCommit(); 368 scheduler->NotifyReadyToCommit();
335 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); 369 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
336 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 370 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
337 client.Reset(); 371 client.Reset();
338 client.task_runner().RunPendingTasks(); // Run posted deadline. 372 client.task_runner().RunPendingTasks(); // Run posted deadline.
339 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2); 373 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2);
340 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); 374 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2);
341 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 375 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
342 376
343 // Because we just swapped, the Scheduler should also request the next 377 // Because we just swapped, the Scheduler should also request the next
344 // BeginImplFrame from the OutputSurface. 378 // BeginImplFrame from the OutputSurface.
345 EXPECT_TRUE(client.needs_begin_frame()); 379 EXPECT_TRUE(client.generate_frames());
346 client.Reset(); 380 client.Reset();
347 // Since another commit is needed, the next BeginImplFrame should initiate 381 // Since another commit is needed, the next BeginImplFrame should initiate
348 // the second commit. 382 // the second commit.
349 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 383 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
350 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 384 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
351 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); 385 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
352 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 386 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
353 client.Reset(); 387 client.Reset();
354 388
355 // Finishing the commit before the deadline should post a new deadline task 389 // Finishing the commit before the deadline should post a new deadline task
356 // to trigger the deadline early. 390 // to trigger the deadline early.
357 scheduler->NotifyBeginMainFrameStarted(); 391 scheduler->NotifyBeginMainFrameStarted();
358 scheduler->NotifyReadyToCommit(); 392 scheduler->NotifyReadyToCommit();
359 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); 393 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
360 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 394 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
361 client.Reset(); 395 client.Reset();
362 client.task_runner().RunPendingTasks(); // Run posted deadline. 396 client.task_runner().RunPendingTasks(); // Run posted deadline.
363 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2); 397 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2);
364 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); 398 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2);
365 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 399 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
366 EXPECT_TRUE(client.needs_begin_frame()); 400 EXPECT_TRUE(client.generate_frames());
367 client.Reset(); 401 client.Reset();
368 402
369 // On the next BeginImplFrame, verify we go back to a quiescent state and 403 // On the next BeginImplFrame, verify we go back to a quiescent state and
370 // no longer request BeginImplFrames. 404 // no longer request BeginImplFrames.
371 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 405 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
372 client.task_runner().RunPendingTasks(); // Run posted deadline. 406 client.task_runner().RunPendingTasks(); // Run posted deadline.
373 EXPECT_FALSE(client.needs_begin_frame()); 407 EXPECT_FALSE(client.generate_frames());
374 client.Reset(); 408 client.Reset();
375 } 409 }
376 410
377 class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient { 411 class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient {
378 public: 412 public:
379 virtual void ScheduledActionSendBeginMainFrame() OVERRIDE {} 413 virtual void ScheduledActionSendBeginMainFrame() OVERRIDE {}
380 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() 414 virtual DrawResult ScheduledActionDrawAndSwapIfPossible()
381 OVERRIDE { 415 OVERRIDE {
382 // Only SetNeedsRedraw the first time this is called 416 // Only SetNeedsRedraw the first time this is called
383 if (!num_draws_) 417 if (!num_draws_)
(...skipping 20 matching lines...) Expand all
404 SchedulerSettings default_scheduler_settings; 438 SchedulerSettings default_scheduler_settings;
405 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 439 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings);
406 scheduler->SetCanStart(); 440 scheduler->SetCanStart();
407 scheduler->SetVisible(true); 441 scheduler->SetVisible(true);
408 scheduler->SetCanDraw(true); 442 scheduler->SetCanDraw(true);
409 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); 443 InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
410 client.Reset(); 444 client.Reset();
411 445
412 scheduler->SetNeedsRedraw(); 446 scheduler->SetNeedsRedraw();
413 EXPECT_TRUE(scheduler->RedrawPending()); 447 EXPECT_TRUE(scheduler->RedrawPending());
414 EXPECT_TRUE(client.needs_begin_frame()); 448 EXPECT_TRUE(client.generate_frames());
415 EXPECT_EQ(0, client.num_draws()); 449 EXPECT_EQ(0, client.num_draws());
416 450
417 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 451 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
418 client.task_runner().RunPendingTasks(); // Run posted deadline. 452 client.task_runner().RunPendingTasks(); // Run posted deadline.
419 EXPECT_EQ(1, client.num_draws()); 453 EXPECT_EQ(1, client.num_draws());
420 EXPECT_TRUE(scheduler->RedrawPending()); 454 EXPECT_TRUE(scheduler->RedrawPending());
421 EXPECT_TRUE(client.needs_begin_frame()); 455 EXPECT_TRUE(client.generate_frames());
422 456
423 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 457 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
424 client.task_runner().RunPendingTasks(); // Run posted deadline. 458 client.task_runner().RunPendingTasks(); // Run posted deadline.
425 EXPECT_EQ(2, client.num_draws()); 459 EXPECT_EQ(2, client.num_draws());
426 EXPECT_FALSE(scheduler->RedrawPending()); 460 EXPECT_FALSE(scheduler->RedrawPending());
427 EXPECT_TRUE(client.needs_begin_frame()); 461 EXPECT_TRUE(client.generate_frames());
428 462
429 // We stop requesting BeginImplFrames after a BeginImplFrame where we don't 463 // We stop requesting BeginImplFrames after a BeginImplFrame where we don't
430 // swap. 464 // swap.
431 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 465 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
432 client.task_runner().RunPendingTasks(); // Run posted deadline. 466 client.task_runner().RunPendingTasks(); // Run posted deadline.
433 EXPECT_EQ(2, client.num_draws()); 467 EXPECT_EQ(2, client.num_draws());
434 EXPECT_FALSE(scheduler->RedrawPending()); 468 EXPECT_FALSE(scheduler->RedrawPending());
435 EXPECT_FALSE(client.needs_begin_frame()); 469 EXPECT_FALSE(client.generate_frames());
436 } 470 }
437 471
438 // Test that requesting redraw inside a failed draw doesn't lose the request. 472 // Test that requesting redraw inside a failed draw doesn't lose the request.
439 TEST(SchedulerTest, RequestRedrawInsideFailedDraw) { 473 TEST(SchedulerTest, RequestRedrawInsideFailedDraw) {
440 SchedulerClientThatsetNeedsDrawInsideDraw client; 474 SchedulerClientThatsetNeedsDrawInsideDraw client;
441 SchedulerSettings default_scheduler_settings; 475 SchedulerSettings default_scheduler_settings;
442 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 476 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings);
443 scheduler->SetCanStart(); 477 scheduler->SetCanStart();
444 scheduler->SetVisible(true); 478 scheduler->SetVisible(true);
445 scheduler->SetCanDraw(true); 479 scheduler->SetCanDraw(true);
446 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); 480 InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
447 client.Reset(); 481 client.Reset();
448 482
449 client.SetDrawWillHappen(false); 483 client.SetDrawWillHappen(false);
450 484
451 scheduler->SetNeedsRedraw(); 485 scheduler->SetNeedsRedraw();
452 EXPECT_TRUE(scheduler->RedrawPending()); 486 EXPECT_TRUE(scheduler->RedrawPending());
453 EXPECT_TRUE(client.needs_begin_frame()); 487 EXPECT_TRUE(client.generate_frames());
454 EXPECT_EQ(0, client.num_draws()); 488 EXPECT_EQ(0, client.num_draws());
455 489
456 // Fail the draw. 490 // Fail the draw.
457 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 491 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
458 client.task_runner().RunPendingTasks(); // Run posted deadline. 492 client.task_runner().RunPendingTasks(); // Run posted deadline.
459 EXPECT_EQ(1, client.num_draws()); 493 EXPECT_EQ(1, client.num_draws());
460 494
461 // We have a commit pending and the draw failed, and we didn't lose the redraw 495 // We have a commit pending and the draw failed, and we didn't lose the redraw
462 // request. 496 // request.
463 EXPECT_TRUE(scheduler->CommitPending()); 497 EXPECT_TRUE(scheduler->CommitPending());
464 EXPECT_TRUE(scheduler->RedrawPending()); 498 EXPECT_TRUE(scheduler->RedrawPending());
465 EXPECT_TRUE(client.needs_begin_frame()); 499 EXPECT_TRUE(client.generate_frames());
466 500
467 // Fail the draw again. 501 // Fail the draw again.
468 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 502 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
469 client.task_runner().RunPendingTasks(); // Run posted deadline. 503 client.task_runner().RunPendingTasks(); // Run posted deadline.
470 EXPECT_EQ(2, client.num_draws()); 504 EXPECT_EQ(2, client.num_draws());
471 EXPECT_TRUE(scheduler->CommitPending()); 505 EXPECT_TRUE(scheduler->CommitPending());
472 EXPECT_TRUE(scheduler->RedrawPending()); 506 EXPECT_TRUE(scheduler->RedrawPending());
473 EXPECT_TRUE(client.needs_begin_frame()); 507 EXPECT_TRUE(client.generate_frames());
474 508
475 // Draw successfully. 509 // Draw successfully.
476 client.SetDrawWillHappen(true); 510 client.SetDrawWillHappen(true);
477 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 511 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
478 client.task_runner().RunPendingTasks(); // Run posted deadline. 512 client.task_runner().RunPendingTasks(); // Run posted deadline.
479 EXPECT_EQ(3, client.num_draws()); 513 EXPECT_EQ(3, client.num_draws());
480 EXPECT_TRUE(scheduler->CommitPending()); 514 EXPECT_TRUE(scheduler->CommitPending());
481 EXPECT_FALSE(scheduler->RedrawPending()); 515 EXPECT_FALSE(scheduler->RedrawPending());
482 EXPECT_TRUE(client.needs_begin_frame()); 516 EXPECT_TRUE(client.generate_frames());
483 } 517 }
484 518
485 class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeSchedulerClient { 519 class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeSchedulerClient {
486 public: 520 public:
487 SchedulerClientThatSetNeedsCommitInsideDraw() 521 SchedulerClientThatSetNeedsCommitInsideDraw()
488 : set_needs_commit_on_next_draw_(false) {} 522 : set_needs_commit_on_next_draw_(false) {}
489 523
490 virtual void ScheduledActionSendBeginMainFrame() OVERRIDE {} 524 virtual void ScheduledActionSendBeginMainFrame() OVERRIDE {}
491 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() 525 virtual DrawResult ScheduledActionDrawAndSwapIfPossible()
492 OVERRIDE { 526 OVERRIDE {
(...skipping 25 matching lines...) Expand all
518 TEST(SchedulerTest, RequestCommitInsideDraw) { 552 TEST(SchedulerTest, RequestCommitInsideDraw) {
519 SchedulerClientThatSetNeedsCommitInsideDraw client; 553 SchedulerClientThatSetNeedsCommitInsideDraw client;
520 SchedulerSettings default_scheduler_settings; 554 SchedulerSettings default_scheduler_settings;
521 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 555 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings);
522 scheduler->SetCanStart(); 556 scheduler->SetCanStart();
523 scheduler->SetVisible(true); 557 scheduler->SetVisible(true);
524 scheduler->SetCanDraw(true); 558 scheduler->SetCanDraw(true);
525 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); 559 InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
526 client.Reset(); 560 client.Reset();
527 561
528 EXPECT_FALSE(client.needs_begin_frame()); 562 EXPECT_FALSE(client.generate_frames());
529 scheduler->SetNeedsRedraw(); 563 scheduler->SetNeedsRedraw();
530 EXPECT_TRUE(scheduler->RedrawPending()); 564 EXPECT_TRUE(scheduler->RedrawPending());
531 EXPECT_EQ(0, client.num_draws()); 565 EXPECT_EQ(0, client.num_draws());
532 EXPECT_TRUE(client.needs_begin_frame()); 566 EXPECT_TRUE(client.generate_frames());
533 567
534 client.SetNeedsCommitOnNextDraw(); 568 client.SetNeedsCommitOnNextDraw();
535 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 569 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
536 client.SetNeedsCommitOnNextDraw(); 570 client.SetNeedsCommitOnNextDraw();
537 client.task_runner().RunPendingTasks(); // Run posted deadline. 571 client.task_runner().RunPendingTasks(); // Run posted deadline.
538 EXPECT_EQ(1, client.num_draws()); 572 EXPECT_EQ(1, client.num_draws());
539 EXPECT_TRUE(scheduler->CommitPending()); 573 EXPECT_TRUE(scheduler->CommitPending());
540 EXPECT_TRUE(client.needs_begin_frame()); 574 EXPECT_TRUE(client.generate_frames());
541 scheduler->NotifyBeginMainFrameStarted(); 575 scheduler->NotifyBeginMainFrameStarted();
542 scheduler->NotifyReadyToCommit(); 576 scheduler->NotifyReadyToCommit();
543 577
544 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 578 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
545 client.task_runner().RunPendingTasks(); // Run posted deadline. 579 client.task_runner().RunPendingTasks(); // Run posted deadline.
546 EXPECT_EQ(2, client.num_draws()); 580 EXPECT_EQ(2, client.num_draws());
547 581
548 EXPECT_FALSE(scheduler->RedrawPending()); 582 EXPECT_FALSE(scheduler->RedrawPending());
549 EXPECT_FALSE(scheduler->CommitPending()); 583 EXPECT_FALSE(scheduler->CommitPending());
550 EXPECT_TRUE(client.needs_begin_frame()); 584 EXPECT_TRUE(client.generate_frames());
551 585
552 // We stop requesting BeginImplFrames after a BeginImplFrame where we don't 586 // We stop requesting BeginImplFrames after a BeginImplFrame where we don't
553 // swap. 587 // swap.
554 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 588 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
555 client.task_runner().RunPendingTasks(); // Run posted deadline. 589 client.task_runner().RunPendingTasks(); // Run posted deadline.
556 EXPECT_EQ(2, client.num_draws()); 590 EXPECT_EQ(2, client.num_draws());
557 EXPECT_FALSE(scheduler->RedrawPending()); 591 EXPECT_FALSE(scheduler->RedrawPending());
558 EXPECT_FALSE(scheduler->CommitPending()); 592 EXPECT_FALSE(scheduler->CommitPending());
559 EXPECT_FALSE(client.needs_begin_frame()); 593 EXPECT_FALSE(client.generate_frames());
560 } 594 }
561 595
562 // Tests that when a draw fails then the pending commit should not be dropped. 596 // Tests that when a draw fails then the pending commit should not be dropped.
563 TEST(SchedulerTest, RequestCommitInsideFailedDraw) { 597 TEST(SchedulerTest, RequestCommitInsideFailedDraw) {
564 SchedulerClientThatsetNeedsDrawInsideDraw client; 598 SchedulerClientThatsetNeedsDrawInsideDraw client;
565 SchedulerSettings default_scheduler_settings; 599 SchedulerSettings default_scheduler_settings;
566 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 600 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings);
567 scheduler->SetCanStart(); 601 scheduler->SetCanStart();
568 scheduler->SetVisible(true); 602 scheduler->SetVisible(true);
569 scheduler->SetCanDraw(true); 603 scheduler->SetCanDraw(true);
570 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); 604 InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
571 client.Reset(); 605 client.Reset();
572 606
573 client.SetDrawWillHappen(false); 607 client.SetDrawWillHappen(false);
574 608
575 scheduler->SetNeedsRedraw(); 609 scheduler->SetNeedsRedraw();
576 EXPECT_TRUE(scheduler->RedrawPending()); 610 EXPECT_TRUE(scheduler->RedrawPending());
577 EXPECT_TRUE(client.needs_begin_frame()); 611 EXPECT_TRUE(client.generate_frames());
578 EXPECT_EQ(0, client.num_draws()); 612 EXPECT_EQ(0, client.num_draws());
579 613
580 // Fail the draw. 614 // Fail the draw.
581 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 615 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
582 client.task_runner().RunPendingTasks(); // Run posted deadline. 616 client.task_runner().RunPendingTasks(); // Run posted deadline.
583 EXPECT_EQ(1, client.num_draws()); 617 EXPECT_EQ(1, client.num_draws());
584 618
585 // We have a commit pending and the draw failed, and we didn't lose the commit 619 // We have a commit pending and the draw failed, and we didn't lose the commit
586 // request. 620 // request.
587 EXPECT_TRUE(scheduler->CommitPending()); 621 EXPECT_TRUE(scheduler->CommitPending());
588 EXPECT_TRUE(scheduler->RedrawPending()); 622 EXPECT_TRUE(scheduler->RedrawPending());
589 EXPECT_TRUE(client.needs_begin_frame()); 623 EXPECT_TRUE(client.generate_frames());
590 624
591 // Fail the draw again. 625 // Fail the draw again.
592 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 626 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
593 627
594 client.task_runner().RunPendingTasks(); // Run posted deadline. 628 client.task_runner().RunPendingTasks(); // Run posted deadline.
595 EXPECT_EQ(2, client.num_draws()); 629 EXPECT_EQ(2, client.num_draws());
596 EXPECT_TRUE(scheduler->CommitPending()); 630 EXPECT_TRUE(scheduler->CommitPending());
597 EXPECT_TRUE(scheduler->RedrawPending()); 631 EXPECT_TRUE(scheduler->RedrawPending());
598 EXPECT_TRUE(client.needs_begin_frame()); 632 EXPECT_TRUE(client.generate_frames());
599 633
600 // Draw successfully. 634 // Draw successfully.
601 client.SetDrawWillHappen(true); 635 client.SetDrawWillHappen(true);
602 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 636 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
603 client.task_runner().RunPendingTasks(); // Run posted deadline. 637 client.task_runner().RunPendingTasks(); // Run posted deadline.
604 EXPECT_EQ(3, client.num_draws()); 638 EXPECT_EQ(3, client.num_draws());
605 EXPECT_TRUE(scheduler->CommitPending()); 639 EXPECT_TRUE(scheduler->CommitPending());
606 EXPECT_FALSE(scheduler->RedrawPending()); 640 EXPECT_FALSE(scheduler->RedrawPending());
607 EXPECT_TRUE(client.needs_begin_frame()); 641 EXPECT_TRUE(client.generate_frames());
608 } 642 }
609 643
610 TEST(SchedulerTest, NoSwapWhenDrawFails) { 644 TEST(SchedulerTest, NoSwapWhenDrawFails) {
611 SchedulerClientThatSetNeedsCommitInsideDraw client; 645 SchedulerClientThatSetNeedsCommitInsideDraw client;
612 SchedulerSettings default_scheduler_settings; 646 SchedulerSettings default_scheduler_settings;
613 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 647 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings);
614 scheduler->SetCanStart(); 648 scheduler->SetCanStart();
615 scheduler->SetVisible(true); 649 scheduler->SetVisible(true);
616 scheduler->SetCanDraw(true); 650 scheduler->SetCanDraw(true);
617 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); 651 InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
618 client.Reset(); 652 client.Reset();
619 653
620 scheduler->SetNeedsRedraw(); 654 scheduler->SetNeedsRedraw();
621 EXPECT_TRUE(scheduler->RedrawPending()); 655 EXPECT_TRUE(scheduler->RedrawPending());
622 EXPECT_TRUE(client.needs_begin_frame()); 656 EXPECT_TRUE(client.generate_frames());
623 EXPECT_EQ(0, client.num_draws()); 657 EXPECT_EQ(0, client.num_draws());
624 658
625 // Draw successfully, this starts a new frame. 659 // Draw successfully, this starts a new frame.
626 client.SetNeedsCommitOnNextDraw(); 660 client.SetNeedsCommitOnNextDraw();
627 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 661 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
628 client.task_runner().RunPendingTasks(); // Run posted deadline. 662 client.task_runner().RunPendingTasks(); // Run posted deadline.
629 EXPECT_EQ(1, client.num_draws()); 663 EXPECT_EQ(1, client.num_draws());
630 664
631 scheduler->SetNeedsRedraw(); 665 scheduler->SetNeedsRedraw();
632 EXPECT_TRUE(scheduler->RedrawPending()); 666 EXPECT_TRUE(scheduler->RedrawPending());
633 EXPECT_TRUE(client.needs_begin_frame()); 667 EXPECT_TRUE(client.generate_frames());
634 668
635 // Fail to draw, this should not start a frame. 669 // Fail to draw, this should not start a frame.
636 client.SetDrawWillHappen(false); 670 client.SetDrawWillHappen(false);
637 client.SetNeedsCommitOnNextDraw(); 671 client.SetNeedsCommitOnNextDraw();
638 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 672 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
639 client.task_runner().RunPendingTasks(); // Run posted deadline. 673 client.task_runner().RunPendingTasks(); // Run posted deadline.
640 EXPECT_EQ(2, client.num_draws()); 674 EXPECT_EQ(2, client.num_draws());
641 } 675 }
642 676
643 class SchedulerClientNeedsManageTilesInDraw : public FakeSchedulerClient { 677 class SchedulerClientNeedsManageTilesInDraw : public FakeSchedulerClient {
644 public: 678 public:
645 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() 679 virtual DrawResult ScheduledActionDrawAndSwapIfPossible()
646 OVERRIDE { 680 OVERRIDE {
647 scheduler_->SetNeedsManageTiles(); 681 scheduler_->SetNeedsManageTiles();
648 return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible(); 682 return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible();
(...skipping 10 matching lines...) Expand all
659 scheduler->SetCanDraw(true); 693 scheduler->SetCanDraw(true);
660 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); 694 InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
661 695
662 // Request both draw and manage tiles. ManageTiles shouldn't 696 // Request both draw and manage tiles. ManageTiles shouldn't
663 // be trigged until BeginImplFrame. 697 // be trigged until BeginImplFrame.
664 client.Reset(); 698 client.Reset();
665 scheduler->SetNeedsManageTiles(); 699 scheduler->SetNeedsManageTiles();
666 scheduler->SetNeedsRedraw(); 700 scheduler->SetNeedsRedraw();
667 EXPECT_TRUE(scheduler->RedrawPending()); 701 EXPECT_TRUE(scheduler->RedrawPending());
668 EXPECT_TRUE(scheduler->ManageTilesPending()); 702 EXPECT_TRUE(scheduler->ManageTilesPending());
669 EXPECT_TRUE(client.needs_begin_frame()); 703 EXPECT_TRUE(client.generate_frames());
670 EXPECT_EQ(0, client.num_draws()); 704 EXPECT_EQ(0, client.num_draws());
671 EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles")); 705 EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles"));
672 EXPECT_FALSE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); 706 EXPECT_FALSE(client.HasAction("ScheduledActionDrawAndSwapIfPossible"));
673 707
674 // We have no immediate actions to perform, so the BeginImplFrame should post 708 // We have no immediate actions to perform, so the BeginImplFrame should post
675 // the deadline task. 709 // the deadline task.
676 client.Reset(); 710 client.Reset();
677 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 711 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
678 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 712 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
679 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); 713 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
680 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 714 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
681 715
682 // On the deadline, he actions should have occured in the right order. 716 // On the deadline, he actions should have occured in the right order.
683 client.Reset(); 717 client.Reset();
684 client.task_runner().RunPendingTasks(); // Run posted deadline. 718 client.task_runner().RunPendingTasks(); // Run posted deadline.
685 EXPECT_EQ(1, client.num_draws()); 719 EXPECT_EQ(1, client.num_draws());
686 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); 720 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible"));
687 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles")); 721 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles"));
688 EXPECT_LT(client.ActionIndex("ScheduledActionDrawAndSwapIfPossible"), 722 EXPECT_LT(client.ActionIndex("ScheduledActionDrawAndSwapIfPossible"),
689 client.ActionIndex("ScheduledActionManageTiles")); 723 client.ActionIndex("ScheduledActionManageTiles"));
690 EXPECT_FALSE(scheduler->RedrawPending()); 724 EXPECT_FALSE(scheduler->RedrawPending());
691 EXPECT_FALSE(scheduler->ManageTilesPending()); 725 EXPECT_FALSE(scheduler->ManageTilesPending());
692 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 726 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
693 727
694 // Request a draw. We don't need a ManageTiles yet. 728 // Request a draw. We don't need a ManageTiles yet.
695 client.Reset(); 729 client.Reset();
696 scheduler->SetNeedsRedraw(); 730 scheduler->SetNeedsRedraw();
697 EXPECT_TRUE(scheduler->RedrawPending()); 731 EXPECT_TRUE(scheduler->RedrawPending());
698 EXPECT_FALSE(scheduler->ManageTilesPending()); 732 EXPECT_FALSE(scheduler->ManageTilesPending());
699 EXPECT_TRUE(client.needs_begin_frame()); 733 EXPECT_TRUE(client.generate_frames());
700 EXPECT_EQ(0, client.num_draws()); 734 EXPECT_EQ(0, client.num_draws());
701 735
702 // We have no immediate actions to perform, so the BeginImplFrame should post 736 // We have no immediate actions to perform, so the BeginImplFrame should post
703 // the deadline task. 737 // the deadline task.
704 client.Reset(); 738 client.Reset();
705 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 739 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
706 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 740 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
707 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); 741 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
708 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 742 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
709 743
710 // Draw. The draw will trigger SetNeedsManageTiles, and 744 // Draw. The draw will trigger SetNeedsManageTiles, and
711 // then the ManageTiles action will be triggered after the Draw. 745 // then the ManageTiles action will be triggered after the Draw.
712 // Afterwards, neither a draw nor ManageTiles are pending. 746 // Afterwards, neither a draw nor ManageTiles are pending.
713 client.Reset(); 747 client.Reset();
714 client.task_runner().RunPendingTasks(); // Run posted deadline. 748 client.task_runner().RunPendingTasks(); // Run posted deadline.
715 EXPECT_EQ(1, client.num_draws()); 749 EXPECT_EQ(1, client.num_draws());
716 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); 750 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible"));
717 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles")); 751 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles"));
718 EXPECT_LT(client.ActionIndex("ScheduledActionDrawAndSwapIfPossible"), 752 EXPECT_LT(client.ActionIndex("ScheduledActionDrawAndSwapIfPossible"),
719 client.ActionIndex("ScheduledActionManageTiles")); 753 client.ActionIndex("ScheduledActionManageTiles"));
720 EXPECT_FALSE(scheduler->RedrawPending()); 754 EXPECT_FALSE(scheduler->RedrawPending());
721 EXPECT_FALSE(scheduler->ManageTilesPending()); 755 EXPECT_FALSE(scheduler->ManageTilesPending());
722 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 756 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
723 757
724 // We need a BeginImplFrame where we don't swap to go idle. 758 // We need a BeginImplFrame where we don't swap to go idle.
725 client.Reset(); 759 client.Reset();
726 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 760 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
727 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); 761 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client);
728 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 762 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
729 client.Reset(); 763 client.Reset();
730 client.task_runner().RunPendingTasks(); // Run posted deadline. 764 client.task_runner().RunPendingTasks(); // Run posted deadline.
731 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); 765 EXPECT_SINGLE_ACTION("SetGenerateFrames", client);
732 EXPECT_FALSE(client.needs_begin_frame()); 766 EXPECT_FALSE(client.generate_frames());
733 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 767 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
734 EXPECT_EQ(0, client.num_draws()); 768 EXPECT_EQ(0, client.num_draws());
735 769
736 // Now trigger a ManageTiles outside of a draw. We will then need 770 // Now trigger a ManageTiles outside of a draw. We will then need
737 // a begin-frame for the ManageTiles, but we don't need a draw. 771 // a begin-frame for the ManageTiles, but we don't need a draw.
738 client.Reset(); 772 client.Reset();
739 EXPECT_FALSE(client.needs_begin_frame()); 773 EXPECT_FALSE(client.generate_frames());
740 scheduler->SetNeedsManageTiles(); 774 scheduler->SetNeedsManageTiles();
741 EXPECT_TRUE(client.needs_begin_frame()); 775 EXPECT_TRUE(client.generate_frames());
742 EXPECT_TRUE(scheduler->ManageTilesPending()); 776 EXPECT_TRUE(scheduler->ManageTilesPending());
743 EXPECT_FALSE(scheduler->RedrawPending()); 777 EXPECT_FALSE(scheduler->RedrawPending());
744 778
745 // BeginImplFrame. There will be no draw, only ManageTiles. 779 // BeginImplFrame. There will be no draw, only ManageTiles.
746 client.Reset(); 780 client.Reset();
747 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 781 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
748 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); 782 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client);
749 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 783 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
750 client.Reset(); 784 client.Reset();
751 client.task_runner().RunPendingTasks(); // Run posted deadline. 785 client.task_runner().RunPendingTasks(); // Run posted deadline.
752 EXPECT_EQ(0, client.num_draws()); 786 EXPECT_EQ(0, client.num_draws());
753 EXPECT_FALSE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); 787 EXPECT_FALSE(client.HasAction("ScheduledActionDrawAndSwapIfPossible"));
754 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles")); 788 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles"));
755 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 789 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
756 } 790 }
757 791
758 // Test that ManageTiles only happens once per frame. If an external caller 792 // Test that ManageTiles only happens once per frame. If an external caller
759 // initiates it, then the state machine should not ManageTiles on that frame. 793 // initiates it, then the state machine should not ManageTiles on that frame.
760 TEST(SchedulerTest, ManageTilesOncePerFrame) { 794 TEST(SchedulerTest, ManageTilesOncePerFrame) {
761 FakeSchedulerClient client; 795 FakeSchedulerClient client;
762 SchedulerSettings default_scheduler_settings; 796 SchedulerSettings default_scheduler_settings;
763 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 797 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings);
764 scheduler->SetCanStart(); 798 scheduler->SetCanStart();
765 scheduler->SetVisible(true); 799 scheduler->SetVisible(true);
766 scheduler->SetCanDraw(true); 800 scheduler->SetCanDraw(true);
767 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); 801 InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
768 802
769 // If DidManageTiles during a frame, then ManageTiles should not occur again. 803 // If DidManageTiles during a frame, then ManageTiles should not occur again.
770 scheduler->SetNeedsManageTiles(); 804 scheduler->SetNeedsManageTiles();
771 scheduler->SetNeedsRedraw(); 805 scheduler->SetNeedsRedraw();
772 client.Reset(); 806 client.Reset();
773 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 807 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
774 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 808 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
775 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); 809 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
776 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 810 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
777 811
778 EXPECT_TRUE(scheduler->ManageTilesPending()); 812 EXPECT_TRUE(scheduler->ManageTilesPending());
779 scheduler->DidManageTiles(); // An explicit ManageTiles. 813 scheduler->DidManageTiles(); // An explicit ManageTiles.
780 EXPECT_FALSE(scheduler->ManageTilesPending()); 814 EXPECT_FALSE(scheduler->ManageTilesPending());
781 815
782 client.Reset(); 816 client.Reset();
783 client.task_runner().RunPendingTasks(); // Run posted deadline. 817 client.task_runner().RunPendingTasks(); // Run posted deadline.
784 EXPECT_EQ(1, client.num_draws()); 818 EXPECT_EQ(1, client.num_draws());
785 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); 819 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible"));
786 EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles")); 820 EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles"));
787 EXPECT_FALSE(scheduler->RedrawPending()); 821 EXPECT_FALSE(scheduler->RedrawPending());
788 EXPECT_FALSE(scheduler->ManageTilesPending()); 822 EXPECT_FALSE(scheduler->ManageTilesPending());
789 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 823 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
790 824
791 // Next frame without DidManageTiles should ManageTiles with draw. 825 // Next frame without DidManageTiles should ManageTiles with draw.
792 scheduler->SetNeedsManageTiles(); 826 scheduler->SetNeedsManageTiles();
793 scheduler->SetNeedsRedraw(); 827 scheduler->SetNeedsRedraw();
794 client.Reset(); 828 client.Reset();
795 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 829 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
796 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 830 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
797 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); 831 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
798 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 832 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
799 833
800 client.Reset(); 834 client.Reset();
801 client.task_runner().RunPendingTasks(); // Run posted deadline. 835 client.task_runner().RunPendingTasks(); // Run posted deadline.
802 EXPECT_EQ(1, client.num_draws()); 836 EXPECT_EQ(1, client.num_draws());
803 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); 837 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible"));
804 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles")); 838 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles"));
805 EXPECT_LT(client.ActionIndex("ScheduledActionDrawAndSwapIfPossible"), 839 EXPECT_LT(client.ActionIndex("ScheduledActionDrawAndSwapIfPossible"),
806 client.ActionIndex("ScheduledActionManageTiles")); 840 client.ActionIndex("ScheduledActionManageTiles"));
807 EXPECT_FALSE(scheduler->RedrawPending()); 841 EXPECT_FALSE(scheduler->RedrawPending());
808 EXPECT_FALSE(scheduler->ManageTilesPending()); 842 EXPECT_FALSE(scheduler->ManageTilesPending());
809 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 843 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
810 scheduler->DidManageTiles(); // Corresponds to ScheduledActionManageTiles 844 scheduler->DidManageTiles(); // Corresponds to ScheduledActionManageTiles
811 845
812 // If we get another DidManageTiles within the same frame, we should 846 // If we get another DidManageTiles within the same frame, we should
813 // not ManageTiles on the next frame. 847 // not ManageTiles on the next frame.
814 scheduler->DidManageTiles(); // An explicit ManageTiles. 848 scheduler->DidManageTiles(); // An explicit ManageTiles.
815 scheduler->SetNeedsManageTiles(); 849 scheduler->SetNeedsManageTiles();
816 scheduler->SetNeedsRedraw(); 850 scheduler->SetNeedsRedraw();
817 client.Reset(); 851 client.Reset();
818 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 852 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
819 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 853 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
820 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); 854 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
821 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 855 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
822 856
823 EXPECT_TRUE(scheduler->ManageTilesPending()); 857 EXPECT_TRUE(scheduler->ManageTilesPending());
824 858
825 client.Reset(); 859 client.Reset();
826 client.task_runner().RunPendingTasks(); // Run posted deadline. 860 client.task_runner().RunPendingTasks(); // Run posted deadline.
827 EXPECT_EQ(1, client.num_draws()); 861 EXPECT_EQ(1, client.num_draws());
828 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); 862 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible"));
829 EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles")); 863 EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles"));
830 EXPECT_FALSE(scheduler->RedrawPending()); 864 EXPECT_FALSE(scheduler->RedrawPending());
831 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 865 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
832 866
833 // If we get another DidManageTiles, we should not ManageTiles on the next 867 // If we get another DidManageTiles, we should not ManageTiles on the next
834 // frame. This verifies we don't alternate calling ManageTiles once and twice. 868 // frame. This verifies we don't alternate calling ManageTiles once and twice.
835 EXPECT_TRUE(scheduler->ManageTilesPending()); 869 EXPECT_TRUE(scheduler->ManageTilesPending());
836 scheduler->DidManageTiles(); // An explicit ManageTiles. 870 scheduler->DidManageTiles(); // An explicit ManageTiles.
837 EXPECT_FALSE(scheduler->ManageTilesPending()); 871 EXPECT_FALSE(scheduler->ManageTilesPending());
838 scheduler->SetNeedsManageTiles(); 872 scheduler->SetNeedsManageTiles();
839 scheduler->SetNeedsRedraw(); 873 scheduler->SetNeedsRedraw();
840 client.Reset(); 874 client.Reset();
841 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 875 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
842 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 876 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
843 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); 877 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
844 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 878 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
845 879
846 EXPECT_TRUE(scheduler->ManageTilesPending()); 880 EXPECT_TRUE(scheduler->ManageTilesPending());
847 881
848 client.Reset(); 882 client.Reset();
849 client.task_runner().RunPendingTasks(); // Run posted deadline. 883 client.task_runner().RunPendingTasks(); // Run posted deadline.
850 EXPECT_EQ(1, client.num_draws()); 884 EXPECT_EQ(1, client.num_draws());
851 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); 885 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible"));
852 EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles")); 886 EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles"));
853 EXPECT_FALSE(scheduler->RedrawPending()); 887 EXPECT_FALSE(scheduler->RedrawPending());
854 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 888 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
855 889
856 // Next frame without DidManageTiles should ManageTiles with draw. 890 // Next frame without DidManageTiles should ManageTiles with draw.
857 scheduler->SetNeedsManageTiles(); 891 scheduler->SetNeedsManageTiles();
858 scheduler->SetNeedsRedraw(); 892 scheduler->SetNeedsRedraw();
859 client.Reset(); 893 client.Reset();
860 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 894 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
861 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 895 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
862 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); 896 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
863 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 897 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
864 898
865 client.Reset(); 899 client.Reset();
866 client.task_runner().RunPendingTasks(); // Run posted deadline. 900 client.task_runner().RunPendingTasks(); // Run posted deadline.
867 EXPECT_EQ(1, client.num_draws()); 901 EXPECT_EQ(1, client.num_draws());
868 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible")); 902 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapIfPossible"));
869 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles")); 903 EXPECT_TRUE(client.HasAction("ScheduledActionManageTiles"));
870 EXPECT_LT(client.ActionIndex("ScheduledActionDrawAndSwapIfPossible"), 904 EXPECT_LT(client.ActionIndex("ScheduledActionDrawAndSwapIfPossible"),
871 client.ActionIndex("ScheduledActionManageTiles")); 905 client.ActionIndex("ScheduledActionManageTiles"));
872 EXPECT_FALSE(scheduler->RedrawPending()); 906 EXPECT_FALSE(scheduler->RedrawPending());
873 EXPECT_FALSE(scheduler->ManageTilesPending()); 907 EXPECT_FALSE(scheduler->ManageTilesPending());
874 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 908 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
875 scheduler->DidManageTiles(); // Corresponds to ScheduledActionManageTiles 909 scheduler->DidManageTiles(); // Corresponds to ScheduledActionManageTiles
876 } 910 }
877 911
878 TEST(SchedulerTest, TriggerBeginFrameDeadlineEarly) { 912 TEST(SchedulerTest, TriggerBeginFrameDeadlineEarly) {
879 SchedulerClientNeedsManageTilesInDraw client; 913 SchedulerClientNeedsManageTilesInDraw client;
880 SchedulerSettings default_scheduler_settings; 914 SchedulerSettings default_scheduler_settings;
881 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 915 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings);
882 scheduler->SetCanStart(); 916 scheduler->SetCanStart();
883 scheduler->SetVisible(true); 917 scheduler->SetVisible(true);
884 scheduler->SetCanDraw(true); 918 scheduler->SetCanDraw(true);
885 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); 919 InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
886 920
887 client.Reset(); 921 client.Reset();
888 scheduler->SetNeedsRedraw(); 922 scheduler->SetNeedsRedraw();
889 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 923 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
890 924
891 // The deadline should be zero since there is no work other than drawing 925 // The deadline should be zero since there is no work other than drawing
892 // pending. 926 // pending.
893 EXPECT_EQ(base::TimeTicks(), client.posted_begin_impl_frame_deadline()); 927 EXPECT_EQ(base::TimeTicks(), client.posted_begin_impl_frame_deadline());
894 } 928 }
895 929
896 class SchedulerClientWithFixedEstimates : public FakeSchedulerClient { 930 class SchedulerClientWithFixedEstimates : public FakeSchedulerClient {
897 public: 931 public:
898 SchedulerClientWithFixedEstimates( 932 SchedulerClientWithFixedEstimates(
899 base::TimeDelta draw_duration, 933 base::TimeDelta draw_duration,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 scheduler->SetCanStart(); 969 scheduler->SetCanStart();
936 scheduler->SetVisible(true); 970 scheduler->SetVisible(true);
937 scheduler->SetCanDraw(true); 971 scheduler->SetCanDraw(true);
938 scheduler->SetSmoothnessTakesPriority(smoothness_takes_priority); 972 scheduler->SetSmoothnessTakesPriority(smoothness_takes_priority);
939 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); 973 InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
940 974
941 // Impl thread hits deadline before commit finishes. 975 // Impl thread hits deadline before commit finishes.
942 client.Reset(); 976 client.Reset();
943 scheduler->SetNeedsCommit(); 977 scheduler->SetNeedsCommit();
944 EXPECT_FALSE(scheduler->MainThreadIsInHighLatencyMode()); 978 EXPECT_FALSE(scheduler->MainThreadIsInHighLatencyMode());
945 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 979 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
946 EXPECT_FALSE(scheduler->MainThreadIsInHighLatencyMode()); 980 EXPECT_FALSE(scheduler->MainThreadIsInHighLatencyMode());
947 client.task_runner().RunPendingTasks(); // Run posted deadline. 981 client.task_runner().RunPendingTasks(); // Run posted deadline.
948 EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); 982 EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode());
949 scheduler->NotifyBeginMainFrameStarted(); 983 scheduler->NotifyBeginMainFrameStarted();
950 scheduler->NotifyReadyToCommit(); 984 scheduler->NotifyReadyToCommit();
951 EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); 985 EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode());
952 EXPECT_TRUE(client.HasAction("ScheduledActionSendBeginMainFrame")); 986 EXPECT_TRUE(client.HasAction("ScheduledActionSendBeginMainFrame"));
953 987
954 client.Reset(); 988 client.Reset();
955 scheduler->SetNeedsCommit(); 989 scheduler->SetNeedsCommit();
956 EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); 990 EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode());
957 scheduler->BeginFrame(CreateBeginFrameArgsForTesting()); 991 client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
958 EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode()); 992 EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode());
959 client.task_runner().RunPendingTasks(); // Run posted deadline. 993 client.task_runner().RunPendingTasks(); // Run posted deadline.
960 EXPECT_EQ(scheduler->MainThreadIsInHighLatencyMode(), 994 EXPECT_EQ(scheduler->MainThreadIsInHighLatencyMode(),
961 should_send_begin_main_frame); 995 should_send_begin_main_frame);
962 EXPECT_EQ(client.HasAction("ScheduledActionSendBeginMainFrame"), 996 EXPECT_EQ(client.HasAction("ScheduledActionSendBeginMainFrame"),
963 should_send_begin_main_frame); 997 should_send_begin_main_frame);
964 } 998 }
965 999
966 TEST(SchedulerTest, 1000 TEST(SchedulerTest,
967 SkipMainFrameIfHighLatencyAndCanCommitAndActivateBeforeDeadline) { 1001 SkipMainFrameIfHighLatencyAndCanCommitAndActivateBeforeDeadline) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 scheduler->DidCreateAndInitializeOutputSurface(); 1040 scheduler->DidCreateAndInitializeOutputSurface();
1007 1041
1008 scheduler->SetNeedsCommit(); 1042 scheduler->SetNeedsCommit();
1009 EXPECT_TRUE(scheduler->CommitPending()); 1043 EXPECT_TRUE(scheduler->CommitPending());
1010 scheduler->NotifyBeginMainFrameStarted(); 1044 scheduler->NotifyBeginMainFrameStarted();
1011 scheduler->NotifyReadyToCommit(); 1045 scheduler->NotifyReadyToCommit();
1012 scheduler->SetNeedsRedraw(); 1046 scheduler->SetNeedsRedraw();
1013 1047
1014 BeginFrameArgs frame_args = CreateBeginFrameArgsForTesting(); 1048 BeginFrameArgs frame_args = CreateBeginFrameArgsForTesting();
1015 frame_args.interval = base::TimeDelta::FromMilliseconds(1000); 1049 frame_args.interval = base::TimeDelta::FromMilliseconds(1000);
1016 scheduler->BeginFrame(frame_args); 1050 client.frame_source().TestBeginFrame(frame_args);
1017 1051
1018 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1052 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1019 client.task_runner().RunPendingTasks(); // Run posted deadline. 1053 client.task_runner().RunPendingTasks(); // Run posted deadline.
1020 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 1054 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
1021 1055
1022 scheduler->DidSwapBuffers(); 1056 scheduler->DidSwapBuffers();
1023 scheduler->DidSwapBuffersComplete(); 1057 scheduler->DidSwapBuffersComplete();
1024 1058
1025 // At this point, we've drawn a frame. Start another commit, but hold off on 1059 // At this point, we've drawn a frame. Start another commit, but hold off on
1026 // the NotifyReadyToCommit for now. 1060 // the NotifyReadyToCommit for now.
1027 EXPECT_FALSE(scheduler->CommitPending()); 1061 EXPECT_FALSE(scheduler->CommitPending());
1028 scheduler->SetNeedsCommit(); 1062 scheduler->SetNeedsCommit();
1029 scheduler->BeginFrame(frame_args); 1063 client.frame_source().TestBeginFrame(frame_args);
1030 EXPECT_TRUE(scheduler->CommitPending()); 1064 EXPECT_TRUE(scheduler->CommitPending());
1031 1065
1032 // Draw and swap the frame, but don't ack the swap to simulate the Browser 1066 // Draw and swap the frame, but don't ack the swap to simulate the Browser
1033 // blocking on the renderer. 1067 // blocking on the renderer.
1034 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1068 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1035 client.task_runner().RunPendingTasks(); // Run posted deadline. 1069 client.task_runner().RunPendingTasks(); // Run posted deadline.
1036 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 1070 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
1037 scheduler->DidSwapBuffers(); 1071 scheduler->DidSwapBuffers();
1038 1072
1039 // Spin the event loop a few times and make sure we get more 1073 // Spin the event loop a few times and make sure we get more
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 SchedulerSettings scheduler_settings; 1105 SchedulerSettings scheduler_settings;
1072 Scheduler* scheduler = client.CreateScheduler(scheduler_settings); 1106 Scheduler* scheduler = client.CreateScheduler(scheduler_settings);
1073 scheduler->SetCanStart(); 1107 scheduler->SetCanStart();
1074 scheduler->SetVisible(true); 1108 scheduler->SetVisible(true);
1075 scheduler->SetCanDraw(true); 1109 scheduler->SetCanDraw(true);
1076 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); 1110 InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
1077 1111
1078 // SetNeedsCommit should begin the frame on the next BeginImplFrame. 1112 // SetNeedsCommit should begin the frame on the next BeginImplFrame.
1079 client.Reset(); 1113 client.Reset();
1080 scheduler->SetNeedsCommit(); 1114 scheduler->SetNeedsCommit();
1081 EXPECT_TRUE(client.needs_begin_frame()); 1115 EXPECT_TRUE(client.generate_frames());
1082 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); 1116 EXPECT_SINGLE_ACTION("SetGenerateFrames", client);
1083 client.Reset(); 1117 client.Reset();
1084 1118
1085 // Create a BeginFrame with a long deadline to avoid race conditions. 1119 // Create a BeginFrame with a long deadline to avoid race conditions.
1086 // This is the first BeginFrame, which will be handled immediately. 1120 // This is the first BeginFrame, which will be handled immediately.
1087 BeginFrameArgs args = CreateBeginFrameArgsForTesting(); 1121 BeginFrameArgs args = CreateBeginFrameArgsForTesting();
1088 args.deadline += base::TimeDelta::FromHours(1); 1122 args.deadline += base::TimeDelta::FromHours(1);
1089 scheduler->BeginFrame(args); 1123 client.frame_source().TestBeginFrame(args);
1090 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 1124 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
1091 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); 1125 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
1092 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1126 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1093 EXPECT_TRUE(client.needs_begin_frame()); 1127 EXPECT_TRUE(client.generate_frames());
1094 client.Reset(); 1128 client.Reset();
1095 1129
1096 // Queue BeginFrames while we are still handling the previous BeginFrame. 1130 // Queue BeginFrames while we are still handling the previous BeginFrame.
1097 args.frame_time += base::TimeDelta::FromSeconds(1); 1131 args.frame_time += base::TimeDelta::FromSeconds(1);
1098 scheduler->BeginFrame(args); 1132 client.frame_source().TestBeginFrame(args);
1099 args.frame_time += base::TimeDelta::FromSeconds(1); 1133 args.frame_time += base::TimeDelta::FromSeconds(1);
1100 scheduler->BeginFrame(args); 1134 client.frame_source().TestBeginFrame(args);
1101 1135
1102 // If we don't swap on the deadline, we wait for the next BeginImplFrame. 1136 // If we don't swap on the deadline, we wait for the next BeginImplFrame.
1103 client.task_runner().RunPendingTasks(); // Run posted deadline. 1137 client.task_runner().RunPendingTasks(); // Run posted deadline.
1104 EXPECT_EQ(0, client.num_actions_()); 1138 EXPECT_EQ(0, client.num_actions_());
1105 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 1139 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
1106 EXPECT_TRUE(client.needs_begin_frame()); 1140 EXPECT_TRUE(client.generate_frames());
1107 client.Reset(); 1141 client.Reset();
1108 1142
1109 // NotifyReadyToCommit should trigger the commit. 1143 // NotifyReadyToCommit should trigger the commit.
1110 scheduler->NotifyBeginMainFrameStarted(); 1144 scheduler->NotifyBeginMainFrameStarted();
1111 scheduler->NotifyReadyToCommit(); 1145 scheduler->NotifyReadyToCommit();
1112 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); 1146 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
1113 EXPECT_TRUE(client.needs_begin_frame()); 1147 EXPECT_TRUE(client.generate_frames());
1114 client.Reset(); 1148 client.Reset();
1115 1149
1116 // BeginImplFrame should prepare the draw. 1150 // BeginImplFrame should prepare the draw.
1117 client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame. 1151 client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame.
1118 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 1152 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
1119 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); 1153 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
1120 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1154 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1121 EXPECT_TRUE(client.needs_begin_frame()); 1155 EXPECT_TRUE(client.generate_frames());
1122 client.Reset(); 1156 client.Reset();
1123 1157
1124 // BeginImplFrame deadline should draw. 1158 // BeginImplFrame deadline should draw.
1125 client.task_runner().RunPendingTasks(); // Run posted deadline. 1159 client.task_runner().RunPendingTasks(); // Run posted deadline.
1126 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); 1160 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
1127 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 1161 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
1128 EXPECT_TRUE(client.needs_begin_frame()); 1162 EXPECT_TRUE(client.generate_frames());
1129 client.Reset(); 1163 client.Reset();
1130 1164
1131 // The following BeginImplFrame deadline should SetNeedsBeginFrame(false) 1165 // The following BeginImplFrame deadline should SetGenerateFrames(false)
1132 // to avoid excessive toggles. 1166 // to avoid excessive toggles.
1133 client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame. 1167 client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame.
1134 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); 1168 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client);
1135 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1169 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1136 client.Reset(); 1170 client.Reset();
1137 1171
1138 client.task_runner().RunPendingTasks(); // Run posted deadline. 1172 client.task_runner().RunPendingTasks(); // Run posted deadline.
1139 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); 1173 EXPECT_SINGLE_ACTION("SetGenerateFrames", client);
1140 EXPECT_FALSE(client.needs_begin_frame()); 1174 EXPECT_FALSE(client.generate_frames());
1141 client.Reset(); 1175 client.Reset();
1142 } 1176 }
1143 1177
1144 TEST(SchedulerTest, BeginRetroFrame_SwapThrottled) { 1178 TEST(SchedulerTest, BeginRetroFrame_SwapThrottled) {
1145 FakeSchedulerClient client; 1179 FakeSchedulerClient client;
1146 SchedulerSettings scheduler_settings; 1180 SchedulerSettings scheduler_settings;
1147 Scheduler* scheduler = client.CreateScheduler(scheduler_settings); 1181 Scheduler* scheduler = client.CreateScheduler(scheduler_settings);
1148 scheduler->SetCanStart(); 1182 scheduler->SetCanStart();
1149 scheduler->SetVisible(true); 1183 scheduler->SetVisible(true);
1150 scheduler->SetCanDraw(true); 1184 scheduler->SetCanDraw(true);
1151 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); 1185 InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
1152 1186
1153 // To test swap ack throttling, this test disables automatic swap acks. 1187 // To test swap ack throttling, this test disables automatic swap acks.
1154 scheduler->SetMaxSwapsPending(1); 1188 scheduler->SetMaxSwapsPending(1);
1155 client.SetAutomaticSwapAck(false); 1189 client.SetAutomaticSwapAck(false);
1156 1190
1157 // SetNeedsCommit should begin the frame on the next BeginImplFrame. 1191 // SetNeedsCommit should begin the frame on the next BeginImplFrame.
1158 client.Reset(); 1192 client.Reset();
1159 scheduler->SetNeedsCommit(); 1193 scheduler->SetNeedsCommit();
1160 EXPECT_TRUE(client.needs_begin_frame()); 1194 EXPECT_TRUE(client.generate_frames());
1161 EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client); 1195 EXPECT_SINGLE_ACTION("SetGenerateFrames", client);
1162 client.Reset(); 1196 client.Reset();
1163 1197
1164 // Create a BeginFrame with a long deadline to avoid race conditions. 1198 // Create a BeginFrame with a long deadline to avoid race conditions.
1165 // This is the first BeginFrame, which will be handled immediately. 1199 // This is the first BeginFrame, which will be handled immediately.
1166 BeginFrameArgs args = CreateBeginFrameArgsForTesting(); 1200 BeginFrameArgs args = CreateBeginFrameArgsForTesting();
1167 args.deadline += base::TimeDelta::FromHours(1); 1201 args.deadline += base::TimeDelta::FromHours(1);
1168 scheduler->BeginFrame(args); 1202 client.frame_source().TestBeginFrame(args);
1169 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 1203 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
1170 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); 1204 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
1171 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1205 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1172 EXPECT_TRUE(client.needs_begin_frame()); 1206 EXPECT_TRUE(client.generate_frames());
1173 client.Reset(); 1207 client.Reset();
1174 1208
1175 // Queue BeginFrame while we are still handling the previous BeginFrame. 1209 // Queue BeginFrame while we are still handling the previous BeginFrame.
1176 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1210 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1177 args.frame_time += base::TimeDelta::FromSeconds(1); 1211 args.frame_time += base::TimeDelta::FromSeconds(1);
1178 scheduler->BeginFrame(args); 1212 client.frame_source().TestBeginFrame(args);
1179 EXPECT_EQ(0, client.num_actions_()); 1213 EXPECT_EQ(0, client.num_actions_());
1180 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1214 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1181 client.Reset(); 1215 client.Reset();
1182 1216
1183 // NotifyReadyToCommit should trigger the pending commit and draw. 1217 // NotifyReadyToCommit should trigger the pending commit and draw.
1184 scheduler->NotifyBeginMainFrameStarted(); 1218 scheduler->NotifyBeginMainFrameStarted();
1185 scheduler->NotifyReadyToCommit(); 1219 scheduler->NotifyReadyToCommit();
1186 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); 1220 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
1187 EXPECT_TRUE(client.needs_begin_frame()); 1221 EXPECT_TRUE(client.generate_frames());
1188 client.Reset(); 1222 client.Reset();
1189 1223
1190 // Swapping will put us into a swap throttled state. 1224 // Swapping will put us into a swap throttled state.
1191 client.task_runner().RunPendingTasks(); // Run posted deadline. 1225 client.task_runner().RunPendingTasks(); // Run posted deadline.
1192 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2); 1226 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2);
1193 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); 1227 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2);
1194 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 1228 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
1195 EXPECT_TRUE(client.needs_begin_frame()); 1229 EXPECT_TRUE(client.generate_frames());
1196 client.Reset(); 1230 client.Reset();
1197 1231
1198 // While swap throttled, BeginRetroFrames should trigger BeginImplFrames 1232 // While swap throttled, BeginRetroFrames should trigger BeginImplFrames
1199 // but not a BeginMainFrame or draw. 1233 // but not a BeginMainFrame or draw.
1200 scheduler->SetNeedsCommit(); 1234 scheduler->SetNeedsCommit();
1201 client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame. 1235 client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame.
1202 EXPECT_ACTION("WillBeginImplFrame", client, 0, 1); 1236 EXPECT_ACTION("WillBeginImplFrame", client, 0, 1);
1203 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1237 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1204 EXPECT_TRUE(client.needs_begin_frame()); 1238 EXPECT_TRUE(client.generate_frames());
1205 client.Reset(); 1239 client.Reset();
1206 1240
1207 // Queue BeginFrame while we are still handling the previous BeginFrame. 1241 // Queue BeginFrame while we are still handling the previous BeginFrame.
1208 args.frame_time += base::TimeDelta::FromSeconds(1); 1242 args.frame_time += base::TimeDelta::FromSeconds(1);
1209 scheduler->BeginFrame(args); 1243 client.frame_source().TestBeginFrame(args);
1210 EXPECT_EQ(0, client.num_actions_()); 1244 EXPECT_EQ(0, client.num_actions_());
1211 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1245 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1212 EXPECT_TRUE(client.needs_begin_frame()); 1246 EXPECT_TRUE(client.generate_frames());
1213 client.Reset(); 1247 client.Reset();
1214 1248
1215 // Take us out of a swap throttled state. 1249 // Take us out of a swap throttled state.
1216 scheduler->DidSwapBuffersComplete(); 1250 scheduler->DidSwapBuffersComplete();
1217 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1); 1251 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1);
1218 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1252 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1219 EXPECT_TRUE(client.needs_begin_frame()); 1253 EXPECT_TRUE(client.generate_frames());
1220 client.Reset(); 1254 client.Reset();
1221 1255
1222 // BeginImplFrame deadline should draw. 1256 // BeginImplFrame deadline should draw.
1223 scheduler->SetNeedsRedraw(); 1257 scheduler->SetNeedsRedraw();
1224 client.task_runner().RunPendingTasks(); // Run posted deadline. 1258 client.task_runner().RunPendingTasks(); // Run posted deadline.
1225 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2); 1259 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2);
1226 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); 1260 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2);
1227 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 1261 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
1228 EXPECT_TRUE(client.needs_begin_frame()); 1262 EXPECT_TRUE(client.generate_frames());
1229 client.Reset(); 1263 client.Reset();
1230 } 1264 }
1231 1265
1232 void BeginFramesNotFromClient(bool begin_frame_scheduling_enabled, 1266 void BeginFramesNotFromClient(bool begin_frame_scheduling_enabled,
1233 bool throttle_frame_production) { 1267 bool throttle_frame_production) {
1234 FakeSchedulerClient client; 1268 FakeSchedulerClient client;
1235 SchedulerSettings scheduler_settings; 1269 SchedulerSettings scheduler_settings;
1236 scheduler_settings.begin_frame_scheduling_enabled = 1270 scheduler_settings.begin_frame_scheduling_enabled =
1237 begin_frame_scheduling_enabled; 1271 begin_frame_scheduling_enabled;
1238 scheduler_settings.throttle_frame_production = throttle_frame_production; 1272 scheduler_settings.throttle_frame_production = throttle_frame_production;
1239 Scheduler* scheduler = client.CreateScheduler(scheduler_settings); 1273 Scheduler* scheduler = client.CreateScheduler(scheduler_settings);
1240 scheduler->SetCanStart(); 1274 scheduler->SetCanStart();
1241 scheduler->SetVisible(true); 1275 scheduler->SetVisible(true);
1242 scheduler->SetCanDraw(true); 1276 scheduler->SetCanDraw(true);
1243 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); 1277 InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
1244 1278
1245 // SetNeedsCommit should begin the frame on the next BeginImplFrame 1279 // SetNeedsCommit should begin the frame on the next BeginImplFrame
1246 // without calling SetNeedsBeginFrame. 1280 // without calling SetGenerateFrames.
1247 client.Reset(); 1281 client.Reset();
1248 scheduler->SetNeedsCommit(); 1282 scheduler->SetNeedsCommit();
1249 EXPECT_FALSE(client.needs_begin_frame()); 1283 EXPECT_FALSE(client.generate_frames());
1250 EXPECT_EQ(0, client.num_actions_()); 1284 EXPECT_EQ(0, client.num_actions_());
1251 client.Reset(); 1285 client.Reset();
1252 1286
1253 // When the client-driven BeginFrame are disabled, the scheduler posts it's 1287 // When the client-driven BeginFrame are disabled, the scheduler posts it's
1254 // own BeginFrame tasks. 1288 // own BeginFrame tasks.
1255 client.task_runner().RunPendingTasks(); // Run posted BeginFrame. 1289 client.task_runner().RunPendingTasks(); // Run posted BeginFrame.
1256 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 1290 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
1257 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); 1291 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
1258 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1292 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1259 EXPECT_FALSE(client.needs_begin_frame()); 1293 EXPECT_FALSE(client.generate_frames());
1260 client.Reset(); 1294 client.Reset();
1261 1295
1262 // If we don't swap on the deadline, we wait for the next BeginFrame. 1296 // If we don't swap on the deadline, we wait for the next BeginFrame.
1263 client.task_runner().RunPendingTasks(); // Run posted deadline. 1297 client.task_runner().RunPendingTasks(); // Run posted deadline.
1264 EXPECT_EQ(0, client.num_actions_()); 1298 EXPECT_EQ(0, client.num_actions_());
1265 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 1299 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
1266 EXPECT_FALSE(client.needs_begin_frame()); 1300 EXPECT_FALSE(client.generate_frames());
1267 client.Reset(); 1301 client.Reset();
1268 1302
1269 // NotifyReadyToCommit should trigger the commit. 1303 // NotifyReadyToCommit should trigger the commit.
1270 scheduler->NotifyBeginMainFrameStarted(); 1304 scheduler->NotifyBeginMainFrameStarted();
1271 scheduler->NotifyReadyToCommit(); 1305 scheduler->NotifyReadyToCommit();
1272 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); 1306 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
1273 EXPECT_FALSE(client.needs_begin_frame()); 1307 EXPECT_FALSE(client.generate_frames());
1274 client.Reset(); 1308 client.Reset();
1275 1309
1276 // BeginImplFrame should prepare the draw. 1310 // BeginImplFrame should prepare the draw.
1277 client.task_runner().RunPendingTasks(); // Run posted BeginFrame. 1311 client.task_runner().RunPendingTasks(); // Run posted BeginFrame.
1278 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 1312 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
1279 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); 1313 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
1280 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1314 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1281 EXPECT_FALSE(client.needs_begin_frame()); 1315 EXPECT_FALSE(client.generate_frames());
1282 client.Reset(); 1316 client.Reset();
1283 1317
1284 // BeginImplFrame deadline should draw. 1318 // BeginImplFrame deadline should draw.
1285 client.task_runner().RunPendingTasks(); // Run posted deadline. 1319 client.task_runner().RunPendingTasks(); // Run posted deadline.
1286 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); 1320 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
1287 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 1321 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
1288 EXPECT_FALSE(client.needs_begin_frame()); 1322 EXPECT_FALSE(client.generate_frames());
1289 client.Reset(); 1323 client.Reset();
1290 1324
1291 // The following BeginImplFrame deadline should SetNeedsBeginFrame(false) 1325 // The following BeginImplFrame deadline should SetGenerateFrames(false)
1292 // to avoid excessive toggles. 1326 // to avoid excessive toggles.
1293 client.task_runner().RunPendingTasks(); // Run posted BeginFrame. 1327 client.task_runner().RunPendingTasks(); // Run posted BeginFrame.
1294 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); 1328 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client);
1295 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1329 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1296 client.Reset(); 1330 client.Reset();
1297 1331
1298 // Make sure SetNeedsBeginFrame isn't called on the client 1332 // Make sure SetGenerateFrames isn't called on the client
1299 // when the BeginFrame is no longer needed. 1333 // when the BeginFrame is no longer needed.
1300 client.task_runner().RunPendingTasks(); // Run posted deadline. 1334 client.task_runner().RunPendingTasks(); // Run posted deadline.
1301 EXPECT_EQ(0, client.num_actions_()); 1335 EXPECT_EQ(0, client.num_actions_());
1302 EXPECT_FALSE(client.needs_begin_frame()); 1336 EXPECT_FALSE(client.generate_frames());
1303 client.Reset(); 1337 client.Reset();
1304 } 1338 }
1305 1339
1306 TEST(SchedulerTest, SyntheticBeginFrames) { 1340 TEST(SchedulerTest, SyntheticBeginFrames) {
1307 bool begin_frame_scheduling_enabled = false; 1341 bool begin_frame_scheduling_enabled = false;
1308 bool throttle_frame_production = true; 1342 bool throttle_frame_production = true;
1309 BeginFramesNotFromClient(begin_frame_scheduling_enabled, 1343 BeginFramesNotFromClient(begin_frame_scheduling_enabled,
1310 throttle_frame_production); 1344 throttle_frame_production);
1311 } 1345 }
1312 1346
(...skipping 24 matching lines...) Expand all
1337 scheduler->SetCanDraw(true); 1371 scheduler->SetCanDraw(true);
1338 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); 1372 InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
1339 1373
1340 // To test swap ack throttling, this test disables automatic swap acks. 1374 // To test swap ack throttling, this test disables automatic swap acks.
1341 scheduler->SetMaxSwapsPending(1); 1375 scheduler->SetMaxSwapsPending(1);
1342 client.SetAutomaticSwapAck(false); 1376 client.SetAutomaticSwapAck(false);
1343 1377
1344 // SetNeedsCommit should begin the frame on the next BeginImplFrame. 1378 // SetNeedsCommit should begin the frame on the next BeginImplFrame.
1345 client.Reset(); 1379 client.Reset();
1346 scheduler->SetNeedsCommit(); 1380 scheduler->SetNeedsCommit();
1347 EXPECT_FALSE(client.needs_begin_frame()); 1381 EXPECT_FALSE(client.generate_frames());
1348 EXPECT_EQ(0, client.num_actions_()); 1382 EXPECT_EQ(0, client.num_actions_());
1349 client.Reset(); 1383 client.Reset();
1350 1384
1351 // Trigger the first BeginImplFrame and BeginMainFrame 1385 // Trigger the first BeginImplFrame and BeginMainFrame
1352 client.task_runner().RunPendingTasks(); // Run posted BeginFrame. 1386 client.task_runner().RunPendingTasks(); // Run posted BeginFrame.
1353 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 1387 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
1354 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); 1388 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
1355 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1389 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1356 EXPECT_FALSE(client.needs_begin_frame()); 1390 EXPECT_FALSE(client.generate_frames());
1357 client.Reset(); 1391 client.Reset();
1358 1392
1359 // NotifyReadyToCommit should trigger the pending commit and draw. 1393 // NotifyReadyToCommit should trigger the pending commit and draw.
1360 scheduler->NotifyBeginMainFrameStarted(); 1394 scheduler->NotifyBeginMainFrameStarted();
1361 scheduler->NotifyReadyToCommit(); 1395 scheduler->NotifyReadyToCommit();
1362 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); 1396 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
1363 EXPECT_FALSE(client.needs_begin_frame()); 1397 EXPECT_FALSE(client.generate_frames());
1364 client.Reset(); 1398 client.Reset();
1365 1399
1366 // Swapping will put us into a swap throttled state. 1400 // Swapping will put us into a swap throttled state.
1367 client.task_runner().RunPendingTasks(); // Run posted deadline. 1401 client.task_runner().RunPendingTasks(); // Run posted deadline.
1368 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2); 1402 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2);
1369 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); 1403 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2);
1370 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 1404 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
1371 EXPECT_FALSE(client.needs_begin_frame()); 1405 EXPECT_FALSE(client.generate_frames());
1372 client.Reset(); 1406 client.Reset();
1373 1407
1374 // While swap throttled, BeginFrames should trigger BeginImplFrames, 1408 // While swap throttled, BeginFrames should trigger BeginImplFrames,
1375 // but not a BeginMainFrame or draw. 1409 // but not a BeginMainFrame or draw.
1376 scheduler->SetNeedsCommit(); 1410 scheduler->SetNeedsCommit();
1377 client.task_runner().RunPendingTasks(); // Run posted BeginFrame. 1411 client.task_runner().RunPendingTasks(); // Run posted BeginFrame.
1378 EXPECT_ACTION("WillBeginImplFrame", client, 0, 1); 1412 EXPECT_ACTION("WillBeginImplFrame", client, 0, 1);
1379 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1413 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1380 EXPECT_FALSE(client.needs_begin_frame()); 1414 EXPECT_FALSE(client.generate_frames());
1381 client.Reset(); 1415 client.Reset();
1382 1416
1383 // Take us out of a swap throttled state. 1417 // Take us out of a swap throttled state.
1384 scheduler->DidSwapBuffersComplete(); 1418 scheduler->DidSwapBuffersComplete();
1385 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1); 1419 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1);
1386 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 1420 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
1387 EXPECT_FALSE(client.needs_begin_frame()); 1421 EXPECT_FALSE(client.generate_frames());
1388 client.Reset(); 1422 client.Reset();
1389 1423
1390 // BeginImplFrame deadline should draw. 1424 // BeginImplFrame deadline should draw.
1391 scheduler->SetNeedsRedraw(); 1425 scheduler->SetNeedsRedraw();
1392 client.task_runner().RunPendingTasks(); // Run posted deadline. 1426 client.task_runner().RunPendingTasks(); // Run posted deadline.
1393 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2); 1427 EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2);
1394 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2); 1428 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2);
1395 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 1429 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
1396 EXPECT_FALSE(client.needs_begin_frame()); 1430 EXPECT_FALSE(client.generate_frames());
1397 client.Reset(); 1431 client.Reset();
1398 } 1432 }
1399 1433
1400 TEST(SchedulerTest, SyntheticBeginFrames_SwapThrottled) { 1434 TEST(SchedulerTest, SyntheticBeginFrames_SwapThrottled) {
1401 bool begin_frame_scheduling_enabled = false; 1435 bool begin_frame_scheduling_enabled = false;
1402 bool throttle_frame_production = true; 1436 bool throttle_frame_production = true;
1403 BeginFramesNotFromClient_SwapThrottled(begin_frame_scheduling_enabled, 1437 BeginFramesNotFromClient_SwapThrottled(begin_frame_scheduling_enabled,
1404 throttle_frame_production); 1438 throttle_frame_production);
1405 } 1439 }
1406 1440
1407 TEST(SchedulerTest, VSyncThrottlingDisabled_SwapThrottled) { 1441 TEST(SchedulerTest, VSyncThrottlingDisabled_SwapThrottled) {
1408 bool begin_frame_scheduling_enabled = true; 1442 bool begin_frame_scheduling_enabled = true;
1409 bool throttle_frame_production = false; 1443 bool throttle_frame_production = false;
1410 BeginFramesNotFromClient_SwapThrottled(begin_frame_scheduling_enabled, 1444 BeginFramesNotFromClient_SwapThrottled(begin_frame_scheduling_enabled,
1411 throttle_frame_production); 1445 throttle_frame_production);
1412 } 1446 }
1413 1447
1414 TEST(SchedulerTest, 1448 TEST(SchedulerTest,
1415 SyntheticBeginFrames_And_VSyncThrottlingDisabled_SwapThrottled) { 1449 SyntheticBeginFrames_And_VSyncThrottlingDisabled_SwapThrottled) {
1416 bool begin_frame_scheduling_enabled = false; 1450 bool begin_frame_scheduling_enabled = false;
1417 bool throttle_frame_production = false; 1451 bool throttle_frame_production = false;
1418 BeginFramesNotFromClient_SwapThrottled(begin_frame_scheduling_enabled, 1452 BeginFramesNotFromClient_SwapThrottled(begin_frame_scheduling_enabled,
1419 throttle_frame_production); 1453 throttle_frame_production);
1420 } 1454 }
1421 1455
1422 } // namespace 1456 } // namespace
1423 } // namespace cc 1457 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | cc/scheduler/time_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698