Commit 2b891d60 authored by ksakamoto's avatar ksakamoto Committed by Commit bot

[FirstMeaningfulPaint] Do not stop observing layouts before FirstContentfulPaint

This should mitigate a bug that FirstMeaningfulPaint is reported too
soon (or not reported) on some CPU-heavy pages, because network idle is
detected while CPU is busy running scripts.

BUG=659021,674228
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2581633002
Cr-Commit-Position: refs/heads/master@{#438791}
parent d82e1629
......@@ -115,7 +115,8 @@ void FirstMeaningfulPaintDetector::checkNetworkStable() {
void FirstMeaningfulPaintDetector::networkStableTimerFired(TimerBase*) {
if (m_state == Reported || !document() ||
document()->fetcher()->hasPendingRequest())
document()->fetcher()->hasPendingRequest() ||
!m_paintTiming->firstContentfulPaint())
return;
if (m_provisionalFirstMeaningfulPaint)
......
......@@ -59,7 +59,7 @@ TEST_F(FirstMeaningfulPaintDetectorTest, NoFirstPaint) {
}
TEST_F(FirstMeaningfulPaintDetectorTest, OneLayout) {
paintTiming().markFirstPaint();
paintTiming().markFirstContentfulPaint();
simulateLayoutAndPaint(1);
double afterPaint = monotonicallyIncreasingTime();
EXPECT_EQ(paintTiming().firstMeaningfulPaint(), 0.0);
......@@ -69,7 +69,7 @@ TEST_F(FirstMeaningfulPaintDetectorTest, OneLayout) {
}
TEST_F(FirstMeaningfulPaintDetectorTest, TwoLayoutsSignificantSecond) {
paintTiming().markFirstPaint();
paintTiming().markFirstContentfulPaint();
simulateLayoutAndPaint(1);
double afterLayout1 = monotonicallyIncreasingTime();
simulateLayoutAndPaint(10);
......@@ -80,7 +80,7 @@ TEST_F(FirstMeaningfulPaintDetectorTest, TwoLayoutsSignificantSecond) {
}
TEST_F(FirstMeaningfulPaintDetectorTest, TwoLayoutsSignificantFirst) {
paintTiming().markFirstPaint();
paintTiming().markFirstContentfulPaint();
simulateLayoutAndPaint(10);
double afterLayout1 = monotonicallyIncreasingTime();
simulateLayoutAndPaint(1);
......@@ -90,7 +90,7 @@ TEST_F(FirstMeaningfulPaintDetectorTest, TwoLayoutsSignificantFirst) {
}
TEST_F(FirstMeaningfulPaintDetectorTest, FirstMeaningfulPaintCandidate) {
paintTiming().markFirstPaint();
paintTiming().markFirstContentfulPaint();
EXPECT_EQ(paintTiming().firstMeaningfulPaintCandidate(), 0.0);
simulateLayoutAndPaint(1);
double afterPaint = monotonicallyIncreasingTime();
......@@ -105,4 +105,15 @@ TEST_F(FirstMeaningfulPaintDetectorTest, FirstMeaningfulPaintCandidate) {
EXPECT_EQ(paintTiming().firstMeaningfulPaintCandidate(), candidate);
}
TEST_F(FirstMeaningfulPaintDetectorTest,
NetworkStableBeforeFirstContentfulPaint) {
paintTiming().markFirstPaint();
simulateLayoutAndPaint(1);
simulateNetworkStable();
EXPECT_EQ(paintTiming().firstMeaningfulPaint(), 0.0);
paintTiming().markFirstContentfulPaint();
simulateNetworkStable();
EXPECT_NE(paintTiming().firstMeaningfulPaint(), 0.0);
}
} // namespace blink
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