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

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: don't reset timing history Created 5 years, 5 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
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | cc/test/fake_layer_tree_host_impl_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/scheduler_unittest.cc
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
index beeb767badaadc238728e9d2f94146be6c352ff3..29505e5a9b76197de307feae951fb44f0565c5c0 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 {
+ 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");
@@ -450,12 +455,13 @@ TEST_F(SchedulerTest, SendBeginFramesToChildrenDeadlineNotAdjusted) {
// Set up client with specified estimates.
scheduler_settings_.use_external_begin_frame_source = true;
SetUpScheduler(true);
- fake_compositor_timing_history_->SetDrawDurationEstimate(
- 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));
+ fake_compositor_timing_history_->SetDrawDurationEstimate(
+ base::TimeDelta::FromMilliseconds(1));
EXPECT_FALSE(client_->needs_begin_frames());
scheduler_->SetChildrenNeedBeginFrames(true);
@@ -710,8 +716,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 +731,6 @@ class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient {
return DRAW_SUCCESS;
}
- void ScheduledActionCommit() override {}
-
private:
bool request_redraws_;
};
@@ -823,7 +825,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 +839,6 @@ class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeSchedulerClient {
return DRAW_SUCCESS;
}
- void ScheduledActionCommit() override {}
-
void SetNeedsCommitOnNextDraw() { set_needs_commit_on_next_draw_ = true; }
private:
@@ -1091,6 +1090,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 +1122,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 +1149,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 +1189,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) {
@@ -1297,13 +1297,13 @@ void SchedulerTest::MainFrameInHighLatencyMode(
scheduler_settings_.use_external_begin_frame_source = true;
SetUpScheduler(true);
- fake_compositor_timing_history_->SetDrawDurationEstimate(
- base::TimeDelta::FromMilliseconds(1));
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));
+ fake_compositor_timing_history_->SetDrawDurationEstimate(
+ base::TimeDelta::FromMilliseconds(1));
scheduler_->SetImplLatencyTakesPriority(impl_latency_takes_priority);
@@ -1370,12 +1370,12 @@ TEST_F(
scheduler_settings_.main_frame_while_swap_throttled_enabled = true;
SetUpScheduler(true);
- fake_compositor_timing_history_->SetDrawDurationEstimate(
- 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));
+ fake_compositor_timing_history_->SetDrawDurationEstimate(
+ base::TimeDelta::FromMilliseconds(1));
// Disables automatic swap acks so this test can force swap ack throttling
// to simulate a blocked Browser ui thread.
@@ -1450,12 +1450,12 @@ TEST_F(SchedulerTest,
scheduler_settings_.main_frame_before_activation_enabled = true;
SetUpScheduler(true);
- fake_compositor_timing_history_->SetDrawDurationEstimate(
- 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));
+ fake_compositor_timing_history_->SetDrawDurationEstimate(
+ base::TimeDelta::FromMilliseconds(1));
// Disables automatic swap acks so this test can force swap ack throttling
// to simulate a blocked Browser ui thread.
@@ -1538,12 +1538,12 @@ TEST_F(
scheduler_settings_.main_frame_before_activation_enabled = true;
SetUpScheduler(true);
- fake_compositor_timing_history_->SetDrawDurationEstimate(
- 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));
+ fake_compositor_timing_history_->SetDrawDurationEstimate(
+ base::TimeDelta::FromMilliseconds(1));
// Disables automatic swap acks so this test can force swap ack throttling
// to simulate a blocked Browser ui thread.
@@ -2852,11 +2852,6 @@ class SchedulerClientSetNeedsPrepareTilesOnDraw : public FakeSchedulerClient {
scheduler_->SetNeedsPrepareTiles();
return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible();
}
-
- void ScheduledActionPrepareTiles() override {
- FakeSchedulerClient::ScheduledActionPrepareTiles();
- scheduler_->DidPrepareTiles();
- }
};
TEST_F(SchedulerTest, SynchronousCompositorPrepareTilesOnDraw) {
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | cc/test/fake_layer_tree_host_impl_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698