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

Unified Diff: cc/scheduler/scheduler_unittest.cc

Issue 1192663005: cc: Measure compositor timing with finer granularity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@modeTimingHistory3
Patch Set: rebase Created 5 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 side-by-side diff with in-line comments
Download patch
Index: cc/scheduler/scheduler_unittest.cc
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
index beeb767badaadc238728e9d2f94146be6c352ff3..a3bde5887514e3346c52108c267698b3267a3d20 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -127,7 +127,10 @@ class FakeSchedulerClient : public SchedulerClient {
PushAction("ScheduledActionDrawAndSwapForced");
return DRAW_SUCCESS;
}
- void ScheduledActionCommit() override { PushAction("ScheduledActionCommit"); }
+ void ScheduledActionCommit() override {
mithro-old 2015/06/30 07:55:49 Why didn't any tests previously depend on this hap
brianderson 2015/06/30 17:35:15 I added Scheduler::DidCommit as part of this patch
+ PushAction("ScheduledActionCommit");
+ scheduler_->DidCommit();
+ }
void ScheduledActionActivateSyncTree() override {
PushAction("ScheduledActionActivateSyncTree");
}
@@ -136,6 +139,8 @@ class FakeSchedulerClient : public SchedulerClient {
}
void ScheduledActionPrepareTiles() override {
PushAction("ScheduledActionPrepareTiles");
+ scheduler_->WillPrepareTiles();
+ scheduler_->DidPrepareTiles();
}
void ScheduledActionInvalidateOutputSurface() override {
actions_.push_back("ScheduledActionInvalidateOutputSurface");
@@ -454,7 +459,7 @@ TEST_F(SchedulerTest, SendBeginFramesToChildrenDeadlineNotAdjusted) {
base::TimeDelta::FromMilliseconds(1));
fake_compositor_timing_history_->SetBeginMainFrameToCommitDurationEstimate(
base::TimeDelta::FromMilliseconds(2));
- fake_compositor_timing_history_->SetCommitToActivateDurationEstimate(
+ fake_compositor_timing_history_->SetCommitToReadyToActivateDurationEstimate(
base::TimeDelta::FromMilliseconds(4));
EXPECT_FALSE(client_->needs_begin_frames());
@@ -710,8 +715,6 @@ class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient {
SchedulerClientThatsetNeedsDrawInsideDraw()
: FakeSchedulerClient(), request_redraws_(false) {}
- void ScheduledActionSendBeginMainFrame() override {}
-
void SetRequestRedrawsInsideDraw(bool enable) { request_redraws_ = enable; }
DrawResult ScheduledActionDrawAndSwapIfPossible() override {
@@ -727,8 +730,6 @@ class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient {
return DRAW_SUCCESS;
}
- void ScheduledActionCommit() override {}
-
private:
bool request_redraws_;
};
@@ -823,7 +824,6 @@ class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeSchedulerClient {
SchedulerClientThatSetNeedsCommitInsideDraw()
: set_needs_commit_on_next_draw_(false) {}
- void ScheduledActionSendBeginMainFrame() override {}
DrawResult ScheduledActionDrawAndSwapIfPossible() override {
// Only SetNeedsCommit the first time this is called
if (set_needs_commit_on_next_draw_) {
@@ -838,8 +838,6 @@ class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeSchedulerClient {
return DRAW_SUCCESS;
}
- void ScheduledActionCommit() override {}
-
void SetNeedsCommitOnNextDraw() { set_needs_commit_on_next_draw_ = true; }
private:
@@ -1091,6 +1089,7 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
EXPECT_TRUE(scheduler_->PrepareTilesPending());
+ scheduler_->WillPrepareTiles();
scheduler_->DidPrepareTiles(); // An explicit PrepareTiles.
EXPECT_FALSE(scheduler_->PrepareTilesPending());
@@ -1122,10 +1121,10 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
EXPECT_FALSE(scheduler_->RedrawPending());
EXPECT_FALSE(scheduler_->PrepareTilesPending());
EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
- scheduler_->DidPrepareTiles(); // Corresponds to ScheduledActionPrepareTiles
// If we get another DidPrepareTiles within the same frame, we should
// not PrepareTiles on the next frame.
+ scheduler_->WillPrepareTiles();
scheduler_->DidPrepareTiles(); // An explicit PrepareTiles.
scheduler_->SetNeedsPrepareTiles();
scheduler_->SetNeedsRedraw();
@@ -1149,6 +1148,7 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
// frame. This verifies we don't alternate calling PrepareTiles once and
// twice.
EXPECT_TRUE(scheduler_->PrepareTilesPending());
+ scheduler_->WillPrepareTiles();
scheduler_->DidPrepareTiles(); // An explicit PrepareTiles.
EXPECT_FALSE(scheduler_->PrepareTilesPending());
scheduler_->SetNeedsPrepareTiles();
@@ -1188,7 +1188,6 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
EXPECT_FALSE(scheduler_->RedrawPending());
EXPECT_FALSE(scheduler_->PrepareTilesPending());
EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
- scheduler_->DidPrepareTiles(); // Corresponds to ScheduledActionPrepareTiles
}
TEST_F(SchedulerTest, TriggerBeginFrameDeadlineEarly) {
@@ -1302,7 +1301,7 @@ void SchedulerTest::MainFrameInHighLatencyMode(
fake_compositor_timing_history_->SetBeginMainFrameToCommitDurationEstimate(
base::TimeDelta::FromMilliseconds(
begin_main_frame_to_commit_estimate_in_ms));
- fake_compositor_timing_history_->SetCommitToActivateDurationEstimate(
+ fake_compositor_timing_history_->SetCommitToReadyToActivateDurationEstimate(
base::TimeDelta::FromMilliseconds(commit_to_activate_estimate_in_ms));
scheduler_->SetImplLatencyTakesPriority(impl_latency_takes_priority);
@@ -1374,7 +1373,7 @@ TEST_F(
base::TimeDelta::FromMilliseconds(1));
fake_compositor_timing_history_->SetBeginMainFrameToCommitDurationEstimate(
base::TimeDelta::FromMilliseconds(32));
- fake_compositor_timing_history_->SetCommitToActivateDurationEstimate(
+ fake_compositor_timing_history_->SetCommitToReadyToActivateDurationEstimate(
base::TimeDelta::FromMilliseconds(32));
// Disables automatic swap acks so this test can force swap ack throttling
@@ -1454,7 +1453,7 @@ TEST_F(SchedulerTest,
base::TimeDelta::FromMilliseconds(1));
fake_compositor_timing_history_->SetBeginMainFrameToCommitDurationEstimate(
base::TimeDelta::FromMilliseconds(32));
- fake_compositor_timing_history_->SetCommitToActivateDurationEstimate(
+ fake_compositor_timing_history_->SetCommitToReadyToActivateDurationEstimate(
base::TimeDelta::FromMilliseconds(32));
// Disables automatic swap acks so this test can force swap ack throttling
@@ -1542,7 +1541,7 @@ TEST_F(
base::TimeDelta::FromMilliseconds(1));
fake_compositor_timing_history_->SetBeginMainFrameToCommitDurationEstimate(
base::TimeDelta::FromMilliseconds(32));
- fake_compositor_timing_history_->SetCommitToActivateDurationEstimate(
+ fake_compositor_timing_history_->SetCommitToReadyToActivateDurationEstimate(
base::TimeDelta::FromMilliseconds(32));
// Disables automatic swap acks so this test can force swap ack throttling
@@ -2852,11 +2851,6 @@ class SchedulerClientSetNeedsPrepareTilesOnDraw : public FakeSchedulerClient {
scheduler_->SetNeedsPrepareTiles();
return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible();
}
-
- void ScheduledActionPrepareTiles() override {
- FakeSchedulerClient::ScheduledActionPrepareTiles();
- scheduler_->DidPrepareTiles();
- }
};
TEST_F(SchedulerTest, SynchronousCompositorPrepareTilesOnDraw) {

Powered by Google App Engine
This is Rietveld 408576698