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

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

Issue 645853008: Standardize usage of virtual/override/final in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted Created 6 years, 2 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
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/surfaces/display.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/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 class FakeSchedulerClient : public SchedulerClient { 48 class FakeSchedulerClient : public SchedulerClient {
49 public: 49 public:
50 struct FakeBeginFrameSourceForFakeSchedulerClient 50 struct FakeBeginFrameSourceForFakeSchedulerClient
51 : public FakeBeginFrameSource { 51 : public FakeBeginFrameSource {
52 FakeSchedulerClient* client_; 52 FakeSchedulerClient* client_;
53 53
54 explicit FakeBeginFrameSourceForFakeSchedulerClient( 54 explicit FakeBeginFrameSourceForFakeSchedulerClient(
55 FakeSchedulerClient* client) 55 FakeSchedulerClient* client)
56 : client_(client) {} 56 : client_(client) {}
57 57
58 virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) override { 58 void OnNeedsBeginFramesChange(bool needs_begin_frames) override {
59 if (needs_begin_frames) { 59 if (needs_begin_frames) {
60 client_->actions_.push_back("SetNeedsBeginFrames(true)"); 60 client_->actions_.push_back("SetNeedsBeginFrames(true)");
61 } else { 61 } else {
62 client_->actions_.push_back("SetNeedsBeginFrames(false)"); 62 client_->actions_.push_back("SetNeedsBeginFrames(false)");
63 } 63 }
64 client_->states_.push_back(client_->scheduler_->AsValue()); 64 client_->states_.push_back(client_->scheduler_->AsValue());
65 } 65 }
66 }; 66 };
67 67
68 class FakePowerMonitorSource : public base::PowerMonitorSource { 68 class FakePowerMonitorSource : public base::PowerMonitorSource {
69 public: 69 public:
70 FakePowerMonitorSource() {} 70 FakePowerMonitorSource() {}
71 virtual ~FakePowerMonitorSource() {} 71 ~FakePowerMonitorSource() override {}
72 void GeneratePowerStateEvent(bool on_battery_power) { 72 void GeneratePowerStateEvent(bool on_battery_power) {
73 on_battery_power_impl_ = on_battery_power; 73 on_battery_power_impl_ = on_battery_power;
74 ProcessPowerEvent(POWER_STATE_EVENT); 74 ProcessPowerEvent(POWER_STATE_EVENT);
75 base::MessageLoop::current()->RunUntilIdle(); 75 base::MessageLoop::current()->RunUntilIdle();
76 } 76 }
77 virtual bool IsOnBatteryPowerImpl() override { 77 bool IsOnBatteryPowerImpl() override { return on_battery_power_impl_; }
78 return on_battery_power_impl_;
79 }
80 78
81 private: 79 private:
82 bool on_battery_power_impl_; 80 bool on_battery_power_impl_;
83 }; 81 };
84 82
85 FakeSchedulerClient() 83 FakeSchedulerClient()
86 : automatic_swap_ack_(true), 84 : automatic_swap_ack_(true),
87 swap_contains_incomplete_tile_(false), 85 swap_contains_incomplete_tile_(false),
88 redraw_will_happen_if_update_visible_tiles_happens_(false), 86 redraw_will_happen_if_update_visible_tiles_happens_(false),
89 now_src_(TestNowSource::Create()), 87 now_src_(TestNowSource::Create()),
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 const char* Action(int i) const { return actions_[i]; } 125 const char* Action(int i) const { return actions_[i]; }
128 std::string StateForAction(int i) const { return states_[i]->ToString(); } 126 std::string StateForAction(int i) const { return states_[i]->ToString(); }
129 base::TimeTicks posted_begin_impl_frame_deadline() const { 127 base::TimeTicks posted_begin_impl_frame_deadline() const {
130 return posted_begin_impl_frame_deadline_; 128 return posted_begin_impl_frame_deadline_;
131 } 129 }
132 130
133 bool ExternalBeginFrame() { 131 bool ExternalBeginFrame() {
134 return scheduler_->settings().begin_frame_scheduling_enabled && 132 return scheduler_->settings().begin_frame_scheduling_enabled &&
135 scheduler_->settings().throttle_frame_production; 133 scheduler_->settings().throttle_frame_production;
136 } 134 }
137 virtual FakeBeginFrameSource* ExternalBeginFrameSource() override { 135 FakeBeginFrameSource* ExternalBeginFrameSource() override {
138 return &fake_frame_source_; 136 return &fake_frame_source_;
139 } 137 }
140 138
141 base::PowerMonitor* PowerMonitor() { return &power_monitor_; } 139 base::PowerMonitor* PowerMonitor() { return &power_monitor_; }
142 140
143 FakePowerMonitorSource* PowerMonitorSource() { 141 FakePowerMonitorSource* PowerMonitorSource() {
144 return fake_power_monitor_source_; 142 return fake_power_monitor_source_;
145 } 143 }
146 144
147 void AdvanceFrame() { 145 void AdvanceFrame() {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 void SetSwapWillHappenIfDrawHappens(bool swap_will_happen_if_draw_happens) { 183 void SetSwapWillHappenIfDrawHappens(bool swap_will_happen_if_draw_happens) {
186 swap_will_happen_if_draw_happens_ = swap_will_happen_if_draw_happens; 184 swap_will_happen_if_draw_happens_ = swap_will_happen_if_draw_happens;
187 } 185 }
188 void SetAutomaticSwapAck(bool automatic_swap_ack) { 186 void SetAutomaticSwapAck(bool automatic_swap_ack) {
189 automatic_swap_ack_ = automatic_swap_ack; 187 automatic_swap_ack_ = automatic_swap_ack;
190 } 188 }
191 void SetRedrawWillHappenIfUpdateVisibleTilesHappens(bool redraw) { 189 void SetRedrawWillHappenIfUpdateVisibleTilesHappens(bool redraw) {
192 redraw_will_happen_if_update_visible_tiles_happens_ = redraw; 190 redraw_will_happen_if_update_visible_tiles_happens_ = redraw;
193 } 191 }
194 // SchedulerClient implementation. 192 // SchedulerClient implementation.
195 virtual void WillBeginImplFrame(const BeginFrameArgs& args) override { 193 void WillBeginImplFrame(const BeginFrameArgs& args) override {
196 actions_.push_back("WillBeginImplFrame"); 194 actions_.push_back("WillBeginImplFrame");
197 states_.push_back(scheduler_->AsValue()); 195 states_.push_back(scheduler_->AsValue());
198 } 196 }
199 virtual void ScheduledActionSendBeginMainFrame() override { 197 void ScheduledActionSendBeginMainFrame() override {
200 actions_.push_back("ScheduledActionSendBeginMainFrame"); 198 actions_.push_back("ScheduledActionSendBeginMainFrame");
201 states_.push_back(scheduler_->AsValue()); 199 states_.push_back(scheduler_->AsValue());
202 } 200 }
203 virtual void ScheduledActionAnimate() override { 201 void ScheduledActionAnimate() override {
204 actions_.push_back("ScheduledActionAnimate"); 202 actions_.push_back("ScheduledActionAnimate");
205 states_.push_back(scheduler_->AsValue()); 203 states_.push_back(scheduler_->AsValue());
206 } 204 }
207 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() override { 205 DrawResult ScheduledActionDrawAndSwapIfPossible() override {
208 actions_.push_back("ScheduledActionDrawAndSwapIfPossible"); 206 actions_.push_back("ScheduledActionDrawAndSwapIfPossible");
209 states_.push_back(scheduler_->AsValue()); 207 states_.push_back(scheduler_->AsValue());
210 num_draws_++; 208 num_draws_++;
211 DrawResult result = 209 DrawResult result =
212 draw_will_happen_ ? DRAW_SUCCESS : DRAW_ABORTED_CHECKERBOARD_ANIMATIONS; 210 draw_will_happen_ ? DRAW_SUCCESS : DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
213 bool swap_will_happen = 211 bool swap_will_happen =
214 draw_will_happen_ && swap_will_happen_if_draw_happens_; 212 draw_will_happen_ && swap_will_happen_if_draw_happens_;
215 if (swap_will_happen) { 213 if (swap_will_happen) {
216 scheduler_->DidSwapBuffers(); 214 scheduler_->DidSwapBuffers();
217 if (swap_contains_incomplete_tile_) { 215 if (swap_contains_incomplete_tile_) {
218 scheduler_->SetSwapUsedIncompleteTile(true); 216 scheduler_->SetSwapUsedIncompleteTile(true);
219 swap_contains_incomplete_tile_ = false; 217 swap_contains_incomplete_tile_ = false;
220 } else { 218 } else {
221 scheduler_->SetSwapUsedIncompleteTile(false); 219 scheduler_->SetSwapUsedIncompleteTile(false);
222 } 220 }
223 221
224 if (automatic_swap_ack_) 222 if (automatic_swap_ack_)
225 scheduler_->DidSwapBuffersComplete(); 223 scheduler_->DidSwapBuffersComplete();
226 } 224 }
227 return result; 225 return result;
228 } 226 }
229 virtual DrawResult ScheduledActionDrawAndSwapForced() override { 227 DrawResult ScheduledActionDrawAndSwapForced() override {
230 actions_.push_back("ScheduledActionDrawAndSwapForced"); 228 actions_.push_back("ScheduledActionDrawAndSwapForced");
231 states_.push_back(scheduler_->AsValue()); 229 states_.push_back(scheduler_->AsValue());
232 return DRAW_SUCCESS; 230 return DRAW_SUCCESS;
233 } 231 }
234 virtual void ScheduledActionCommit() override { 232 void ScheduledActionCommit() override {
235 actions_.push_back("ScheduledActionCommit"); 233 actions_.push_back("ScheduledActionCommit");
236 states_.push_back(scheduler_->AsValue()); 234 states_.push_back(scheduler_->AsValue());
237 } 235 }
238 virtual void ScheduledActionUpdateVisibleTiles() override { 236 void ScheduledActionUpdateVisibleTiles() override {
239 actions_.push_back("ScheduledActionUpdateVisibleTiles"); 237 actions_.push_back("ScheduledActionUpdateVisibleTiles");
240 states_.push_back(scheduler_->AsValue()); 238 states_.push_back(scheduler_->AsValue());
241 if (redraw_will_happen_if_update_visible_tiles_happens_) 239 if (redraw_will_happen_if_update_visible_tiles_happens_)
242 scheduler_->SetNeedsRedraw(); 240 scheduler_->SetNeedsRedraw();
243 } 241 }
244 virtual void ScheduledActionActivateSyncTree() override { 242 void ScheduledActionActivateSyncTree() override {
245 actions_.push_back("ScheduledActionActivateSyncTree"); 243 actions_.push_back("ScheduledActionActivateSyncTree");
246 states_.push_back(scheduler_->AsValue()); 244 states_.push_back(scheduler_->AsValue());
247 } 245 }
248 virtual void ScheduledActionBeginOutputSurfaceCreation() override { 246 void ScheduledActionBeginOutputSurfaceCreation() override {
249 actions_.push_back("ScheduledActionBeginOutputSurfaceCreation"); 247 actions_.push_back("ScheduledActionBeginOutputSurfaceCreation");
250 states_.push_back(scheduler_->AsValue()); 248 states_.push_back(scheduler_->AsValue());
251 } 249 }
252 virtual void ScheduledActionManageTiles() override { 250 void ScheduledActionManageTiles() override {
253 actions_.push_back("ScheduledActionManageTiles"); 251 actions_.push_back("ScheduledActionManageTiles");
254 states_.push_back(scheduler_->AsValue()); 252 states_.push_back(scheduler_->AsValue());
255 } 253 }
256 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks) override { 254 void DidAnticipatedDrawTimeChange(base::TimeTicks) override {
257 if (log_anticipated_draw_time_change_) 255 if (log_anticipated_draw_time_change_)
258 actions_.push_back("DidAnticipatedDrawTimeChange"); 256 actions_.push_back("DidAnticipatedDrawTimeChange");
259 } 257 }
260 virtual base::TimeDelta DrawDurationEstimate() override { 258 base::TimeDelta DrawDurationEstimate() override { return base::TimeDelta(); }
259 base::TimeDelta BeginMainFrameToCommitDurationEstimate() override {
261 return base::TimeDelta(); 260 return base::TimeDelta();
262 } 261 }
263 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() override { 262 base::TimeDelta CommitToActivateDurationEstimate() override {
264 return base::TimeDelta();
265 }
266 virtual base::TimeDelta CommitToActivateDurationEstimate() override {
267 return base::TimeDelta(); 263 return base::TimeDelta();
268 } 264 }
269 265
270 virtual void DidBeginImplFrameDeadline() override {} 266 void DidBeginImplFrameDeadline() override {}
271 267
272 base::Callback<bool(void)> ImplFrameDeadlinePending(bool state) { 268 base::Callback<bool(void)> ImplFrameDeadlinePending(bool state) {
273 return base::Bind(&FakeSchedulerClient::ImplFrameDeadlinePendingCallback, 269 return base::Bind(&FakeSchedulerClient::ImplFrameDeadlinePendingCallback,
274 base::Unretained(this), 270 base::Unretained(this),
275 state); 271 state);
276 } 272 }
277 273
278 protected: 274 protected:
279 bool ImplFrameDeadlinePendingCallback(bool state) { 275 bool ImplFrameDeadlinePendingCallback(bool state) {
280 return scheduler_->BeginImplFrameDeadlinePending() == state; 276 return scheduler_->BeginImplFrameDeadlinePending() == state;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 // On the next BeginImplFrame, verify we go back to a quiescent state and 480 // On the next BeginImplFrame, verify we go back to a quiescent state and
485 // no longer request BeginImplFrames. 481 // no longer request BeginImplFrames.
486 client.AdvanceFrame(); 482 client.AdvanceFrame();
487 client.task_runner().RunPendingTasks(); // Run posted deadline. 483 client.task_runner().RunPendingTasks(); // Run posted deadline.
488 EXPECT_FALSE(client.needs_begin_frames()); 484 EXPECT_FALSE(client.needs_begin_frames());
489 client.Reset(); 485 client.Reset();
490 } 486 }
491 487
492 class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient { 488 class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient {
493 public: 489 public:
494 virtual void ScheduledActionSendBeginMainFrame() override {} 490 void ScheduledActionSendBeginMainFrame() override {}
495 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() 491 DrawResult ScheduledActionDrawAndSwapIfPossible() override {
496 override {
497 // Only SetNeedsRedraw the first time this is called 492 // Only SetNeedsRedraw the first time this is called
498 if (!num_draws_) 493 if (!num_draws_)
499 scheduler_->SetNeedsRedraw(); 494 scheduler_->SetNeedsRedraw();
500 return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible(); 495 return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible();
501 } 496 }
502 497
503 virtual DrawResult ScheduledActionDrawAndSwapForced() override { 498 DrawResult ScheduledActionDrawAndSwapForced() override {
504 NOTREACHED(); 499 NOTREACHED();
505 return DRAW_SUCCESS; 500 return DRAW_SUCCESS;
506 } 501 }
507 502
508 virtual void ScheduledActionCommit() override {} 503 void ScheduledActionCommit() override {}
509 virtual void ScheduledActionBeginOutputSurfaceCreation() override {} 504 void ScheduledActionBeginOutputSurfaceCreation() override {}
510 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks) override {} 505 void DidAnticipatedDrawTimeChange(base::TimeTicks) override {}
511 }; 506 };
512 507
513 // Tests for two different situations: 508 // Tests for two different situations:
514 // 1. the scheduler dropping SetNeedsRedraw requests that happen inside 509 // 1. the scheduler dropping SetNeedsRedraw requests that happen inside
515 // a ScheduledActionDrawAndSwap 510 // a ScheduledActionDrawAndSwap
516 // 2. the scheduler drawing twice inside a single tick 511 // 2. the scheduler drawing twice inside a single tick
517 TEST(SchedulerTest, RequestRedrawInsideDraw) { 512 TEST(SchedulerTest, RequestRedrawInsideDraw) {
518 SchedulerClientThatsetNeedsDrawInsideDraw client; 513 SchedulerClientThatsetNeedsDrawInsideDraw client;
519 SchedulerSettings default_scheduler_settings; 514 SchedulerSettings default_scheduler_settings;
520 TestScheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 515 TestScheduler* scheduler = client.CreateScheduler(default_scheduler_settings);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 EXPECT_TRUE(scheduler->CommitPending()); 590 EXPECT_TRUE(scheduler->CommitPending());
596 EXPECT_FALSE(scheduler->RedrawPending()); 591 EXPECT_FALSE(scheduler->RedrawPending());
597 EXPECT_TRUE(client.needs_begin_frames()); 592 EXPECT_TRUE(client.needs_begin_frames());
598 } 593 }
599 594
600 class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeSchedulerClient { 595 class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeSchedulerClient {
601 public: 596 public:
602 SchedulerClientThatSetNeedsCommitInsideDraw() 597 SchedulerClientThatSetNeedsCommitInsideDraw()
603 : set_needs_commit_on_next_draw_(false) {} 598 : set_needs_commit_on_next_draw_(false) {}
604 599
605 virtual void ScheduledActionSendBeginMainFrame() override {} 600 void ScheduledActionSendBeginMainFrame() override {}
606 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() 601 DrawResult ScheduledActionDrawAndSwapIfPossible() override {
607 override {
608 // Only SetNeedsCommit the first time this is called 602 // Only SetNeedsCommit the first time this is called
609 if (set_needs_commit_on_next_draw_) { 603 if (set_needs_commit_on_next_draw_) {
610 scheduler_->SetNeedsCommit(); 604 scheduler_->SetNeedsCommit();
611 set_needs_commit_on_next_draw_ = false; 605 set_needs_commit_on_next_draw_ = false;
612 } 606 }
613 return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible(); 607 return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible();
614 } 608 }
615 609
616 virtual DrawResult ScheduledActionDrawAndSwapForced() override { 610 DrawResult ScheduledActionDrawAndSwapForced() override {
617 NOTREACHED(); 611 NOTREACHED();
618 return DRAW_SUCCESS; 612 return DRAW_SUCCESS;
619 } 613 }
620 614
621 virtual void ScheduledActionCommit() override {} 615 void ScheduledActionCommit() override {}
622 virtual void ScheduledActionBeginOutputSurfaceCreation() override {} 616 void ScheduledActionBeginOutputSurfaceCreation() override {}
623 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks) override {} 617 void DidAnticipatedDrawTimeChange(base::TimeTicks) override {}
624 618
625 void SetNeedsCommitOnNextDraw() { set_needs_commit_on_next_draw_ = true; } 619 void SetNeedsCommitOnNextDraw() { set_needs_commit_on_next_draw_ = true; }
626 620
627 private: 621 private:
628 bool set_needs_commit_on_next_draw_; 622 bool set_needs_commit_on_next_draw_;
629 }; 623 };
630 624
631 // Tests for the scheduler infinite-looping on SetNeedsCommit requests that 625 // Tests for the scheduler infinite-looping on SetNeedsCommit requests that
632 // happen inside a ScheduledActionDrawAndSwap 626 // happen inside a ScheduledActionDrawAndSwap
633 TEST(SchedulerTest, RequestCommitInsideDraw) { 627 TEST(SchedulerTest, RequestCommitInsideDraw) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 // Fail to draw, this should not start a frame. 744 // Fail to draw, this should not start a frame.
751 client.SetDrawWillHappen(false); 745 client.SetDrawWillHappen(false);
752 client.SetNeedsCommitOnNextDraw(); 746 client.SetNeedsCommitOnNextDraw();
753 client.AdvanceFrame(); 747 client.AdvanceFrame();
754 client.task_runner().RunPendingTasks(); // Run posted deadline. 748 client.task_runner().RunPendingTasks(); // Run posted deadline.
755 EXPECT_EQ(2, client.num_draws()); 749 EXPECT_EQ(2, client.num_draws());
756 } 750 }
757 751
758 class SchedulerClientNeedsManageTilesInDraw : public FakeSchedulerClient { 752 class SchedulerClientNeedsManageTilesInDraw : public FakeSchedulerClient {
759 public: 753 public:
760 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() 754 DrawResult ScheduledActionDrawAndSwapIfPossible() override {
761 override {
762 scheduler_->SetNeedsManageTiles(); 755 scheduler_->SetNeedsManageTiles();
763 return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible(); 756 return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible();
764 } 757 }
765 }; 758 };
766 759
767 // Test manage tiles is independant of draws. 760 // Test manage tiles is independant of draws.
768 TEST(SchedulerTest, ManageTiles) { 761 TEST(SchedulerTest, ManageTiles) {
769 SchedulerClientNeedsManageTilesInDraw client; 762 SchedulerClientNeedsManageTilesInDraw client;
770 SchedulerSettings default_scheduler_settings; 763 SchedulerSettings default_scheduler_settings;
771 TestScheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 764 TestScheduler* scheduler = client.CreateScheduler(default_scheduler_settings);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 public: 1065 public:
1073 SchedulerClientWithFixedEstimates( 1066 SchedulerClientWithFixedEstimates(
1074 base::TimeDelta draw_duration, 1067 base::TimeDelta draw_duration,
1075 base::TimeDelta begin_main_frame_to_commit_duration, 1068 base::TimeDelta begin_main_frame_to_commit_duration,
1076 base::TimeDelta commit_to_activate_duration) 1069 base::TimeDelta commit_to_activate_duration)
1077 : draw_duration_(draw_duration), 1070 : draw_duration_(draw_duration),
1078 begin_main_frame_to_commit_duration_( 1071 begin_main_frame_to_commit_duration_(
1079 begin_main_frame_to_commit_duration), 1072 begin_main_frame_to_commit_duration),
1080 commit_to_activate_duration_(commit_to_activate_duration) {} 1073 commit_to_activate_duration_(commit_to_activate_duration) {}
1081 1074
1082 virtual base::TimeDelta DrawDurationEstimate() override { 1075 base::TimeDelta DrawDurationEstimate() override { return draw_duration_; }
1083 return draw_duration_; 1076 base::TimeDelta BeginMainFrameToCommitDurationEstimate() override {
1084 }
1085 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() override {
1086 return begin_main_frame_to_commit_duration_; 1077 return begin_main_frame_to_commit_duration_;
1087 } 1078 }
1088 virtual base::TimeDelta CommitToActivateDurationEstimate() override { 1079 base::TimeDelta CommitToActivateDurationEstimate() override {
1089 return commit_to_activate_duration_; 1080 return commit_to_activate_duration_;
1090 } 1081 }
1091 1082
1092 private: 1083 private:
1093 base::TimeDelta draw_duration_; 1084 base::TimeDelta draw_duration_;
1094 base::TimeDelta begin_main_frame_to_commit_duration_; 1085 base::TimeDelta begin_main_frame_to_commit_duration_;
1095 base::TimeDelta commit_to_activate_duration_; 1086 base::TimeDelta commit_to_activate_duration_;
1096 }; 1087 };
1097 1088
1098 void MainFrameInHighLatencyMode(int64 begin_main_frame_to_commit_estimate_in_ms, 1089 void MainFrameInHighLatencyMode(int64 begin_main_frame_to_commit_estimate_in_ms,
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after
2145 2136
2146 // Deadline task is pending 2137 // Deadline task is pending
2147 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 2138 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
2148 client.task_runner().RunPendingTasks(); 2139 client.task_runner().RunPendingTasks();
2149 // Deadline task runs immediately 2140 // Deadline task runs immediately
2150 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 2141 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
2151 } 2142 }
2152 2143
2153 } // namespace 2144 } // namespace
2154 } // namespace cc 2145 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/surfaces/display.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698