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

Unified Diff: cc/paint/paint_op_buffer_unittest.cc

Issue 2876033005: Track slow paths in DisplayItemList (Closed)
Patch Set: danakj review Created 3 years, 7 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/paint/paint_op_buffer.cc ('k') | third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/paint/paint_op_buffer_unittest.cc
diff --git a/cc/paint/paint_op_buffer_unittest.cc b/cc/paint/paint_op_buffer_unittest.cc
index 5751c2fa1e0df34c56b9c932f23eb4a0619ee1a4..b85bc5d68aa6b98e73d03860b55a5fa296678a25 100644
--- a/cc/paint/paint_op_buffer_unittest.cc
+++ b/cc/paint/paint_op_buffer_unittest.cc
@@ -497,7 +497,24 @@ TEST(PaintOpBufferTest, SlowPaths) {
auto buffer2 = sk_make_sp<PaintOpBuffer>();
EXPECT_EQ(buffer2->numSlowPaths(), 0);
buffer2->push<DrawRecordOp>(buffer);
- EXPECT_EQ(buffer->numSlowPaths(), buffer2->numSlowPaths());
+ EXPECT_EQ(buffer2->numSlowPaths(), 2);
+ buffer2->push<DrawRecordOp>(buffer);
+ EXPECT_EQ(buffer2->numSlowPaths(), 4);
+
+ // Drawing an empty display item list doesn't change anything.
+ auto empty_list = base::MakeRefCounted<DisplayItemList>();
+ buffer2->push<DrawDisplayItemListOp>(empty_list);
+ EXPECT_EQ(buffer2->numSlowPaths(), 4);
+
+ // Drawing a display item list adds the items from that list.
+ auto slow_path_list = base::MakeRefCounted<DisplayItemList>();
+ slow_path_list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
+ gfx::Rect(1, 2, 3, 4), sk_make_sp<PaintOpBuffer>(),
+ SkRect::MakeXYWH(1, 2, 3, 4));
+ // Setting this properly is tested in PaintControllerTest.cpp.
+ slow_path_list->SetNumSlowPaths(50);
+ buffer2->push<DrawDisplayItemListOp>(slow_path_list);
+ EXPECT_EQ(buffer2->numSlowPaths(), 54);
}
TEST(PaintOpBufferTest, ContiguousRanges) {
« no previous file with comments | « cc/paint/paint_op_buffer.cc ('k') | third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698