Commit ba57b0cc authored by Mohsen Izadi's avatar Mohsen Izadi Committed by Commit Bot

Fix CompositorFrameReporter dropped frame test

CompositorFrameReporterTest.SubmittedDroppedFrameReportingTest calls
DroppedFrame() explicitly and then terminates reporter with
kPresentedFrame status. This is not what happens in production code. We
just need to terminate frame with kDidNotPresentedFrame or
kReplacedByNewReporter and it will take care of reporting a dropped
frame.

Bug: None
Change-Id: I43059f31e77ec14818b856e51d24e7ea7a6c4545
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2037340Reviewed-by: default avatarBehdad Bakhshinategh <behdadb@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Mohsen Izadi <mohsen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738248}
parent 33029b89
...@@ -214,10 +214,6 @@ void CompositorFrameReporter::EndCurrentStage(base::TimeTicks end_time) { ...@@ -214,10 +214,6 @@ void CompositorFrameReporter::EndCurrentStage(base::TimeTicks end_time) {
current_stage_.start_time = base::TimeTicks(); current_stage_.start_time = base::TimeTicks();
} }
void CompositorFrameReporter::DroppedFrame() {
report_type_ = DroppedFrameReportType::kDroppedFrame;
}
void CompositorFrameReporter::TerminateFrame( void CompositorFrameReporter::TerminateFrame(
FrameTerminationStatus termination_status, FrameTerminationStatus termination_status,
base::TimeTicks termination_time) { base::TimeTicks termination_time) {
...@@ -261,6 +257,10 @@ void CompositorFrameReporter::SetVizBreakdown( ...@@ -261,6 +257,10 @@ void CompositorFrameReporter::SetVizBreakdown(
viz_breakdown_ = viz_breakdown; viz_breakdown_ = viz_breakdown;
} }
void CompositorFrameReporter::DroppedFrame() {
report_type_ = DroppedFrameReportType::kDroppedFrame;
}
void CompositorFrameReporter::TerminateReporter() { void CompositorFrameReporter::TerminateReporter() {
if (frame_termination_status_ == FrameTerminationStatus::kUnknown) if (frame_termination_status_ == FrameTerminationStatus::kUnknown)
TerminateFrame(FrameTerminationStatus::kUnknown, base::TimeTicks::Now()); TerminateFrame(FrameTerminationStatus::kUnknown, base::TimeTicks::Now());
......
...@@ -129,8 +129,6 @@ class CC_EXPORT CompositorFrameReporter { ...@@ -129,8 +129,6 @@ class CC_EXPORT CompositorFrameReporter {
const viz::BeginFrameId frame_id_; const viz::BeginFrameId frame_id_;
void DroppedFrame();
// Note that the started stage may be reported to UMA. If the histogram is // Note that the started stage may be reported to UMA. If the histogram is
// intended to be reported then the histograms.xml file must be updated too. // intended to be reported then the histograms.xml file must be updated too.
void StartStage(StageType stage_type, base::TimeTicks start_time); void StartStage(StageType stage_type, base::TimeTicks start_time);
...@@ -151,6 +149,8 @@ class CC_EXPORT CompositorFrameReporter { ...@@ -151,6 +149,8 @@ class CC_EXPORT CompositorFrameReporter {
} }
private: private:
void DroppedFrame();
void TerminateReporter(); void TerminateReporter();
void EndCurrentStage(base::TimeTicks end_time); void EndCurrentStage(base::TimeTicks end_time);
void ReportStageHistograms() const; void ReportStageHistograms() const;
......
...@@ -154,9 +154,9 @@ TEST_F(CompositorFrameReporterTest, SubmittedDroppedFrameReportingTest) { ...@@ -154,9 +154,9 @@ TEST_F(CompositorFrameReporterTest, SubmittedDroppedFrameReportingTest) {
EXPECT_EQ(1, pipeline_reporter_->StageHistorySizeForTesting()); EXPECT_EQ(1, pipeline_reporter_->StageHistorySizeForTesting());
AdvanceNowByMs(2); AdvanceNowByMs(2);
pipeline_reporter_->DroppedFrame();
pipeline_reporter_->TerminateFrame( pipeline_reporter_->TerminateFrame(
CompositorFrameReporter::FrameTerminationStatus::kPresentedFrame, Now()); CompositorFrameReporter::FrameTerminationStatus::kDidNotPresentFrame,
Now());
EXPECT_EQ(2, pipeline_reporter_->StageHistorySizeForTesting()); EXPECT_EQ(2, pipeline_reporter_->StageHistorySizeForTesting());
pipeline_reporter_ = nullptr; pipeline_reporter_ = nullptr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment