Commit acb93eec authored by Liquan(Max) Gu's avatar Liquan(Max) Gu Committed by Commit Bot

[FCP++] Report LargestImagePaint==0 when nodes are all removed

The original implementation does not report an update to performance timing
when the number of nodes is reduced to 0. This CL is to correct this behavior.

Bug: 869924
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Iff578e793965ae89f0e865f175335bb9a318fb9c
Reviewed-on: https://chromium-review.googlesource.com/c/1289702Reviewed-by: default avatarSteve Kobes <skobes@chromium.org>
Commit-Queue: Liquan (Max) Gǔ <maxlg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601163}
parent b00dc7ad
......@@ -156,6 +156,19 @@ void ImagePaintTimingDetector::NotifyNodeRemoved(DOMNodeId node_id) {
// bother to remove these records from largest_image_heap_ or
// latest_image_heap_, to reduce computation.
id_record_map_.erase(node_id);
if (id_record_map_.size() == 0) {
const bool largest_image_paint_invalidated =
largest_image_paint_ != base::TimeTicks();
const bool last_image_paint_invalidated =
last_image_paint_ != base::TimeTicks();
if (largest_image_paint_invalidated)
largest_image_paint_ = base::TimeTicks();
if (last_image_paint_invalidated)
last_image_paint_ = base::TimeTicks();
if (largest_image_paint_invalidated || last_image_paint_invalidated)
frame_view_->GetPaintTracker().DidChangePerformanceTiming();
}
}
}
......
......@@ -69,8 +69,8 @@ class CORE_EXPORT ImagePaintTimingDetector final
const PaintLayer& painting_layer);
void OnPrePaintFinished();
void NotifyNodeRemoved(DOMNodeId);
base::TimeTicks LargestImagePaint() { return largest_image_paint_; }
base::TimeTicks LastImagePaint() { return last_image_paint_; }
base::TimeTicks LargestImagePaint() const { return largest_image_paint_; }
base::TimeTicks LastImagePaint() const { return last_image_paint_; }
void Trace(blink::Visitor*);
private:
......
......@@ -178,12 +178,14 @@ TEST_F(ImagePaintTimingDetectorTest, LargestImagePaint_IgnoreTheRemoved) {
ImageRecord* record;
record = FindLargestPaintCandidate();
EXPECT_TRUE(record);
EXPECT_NE(LargestPaintStoredResult(), base::TimeTicks());
GetDocument().getElementById("parent")->RemoveChild(
GetDocument().getElementById("target"));
UpdateAllLifecyclePhasesAndInvokeCallbackIfAny();
record = FindLargestPaintCandidate();
EXPECT_FALSE(record);
EXPECT_EQ(LargestPaintStoredResult(), base::TimeTicks());
}
TEST_F(ImagePaintTimingDetectorTest,
......
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