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

Unified Diff: Source/platform/graphics/paint/DisplayItemListTest.cpp

Issue 1193433004: Blink-side contiguous allocation of display items. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Minor tweaks to make reviewing easier Created 5 years, 6 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
Index: Source/platform/graphics/paint/DisplayItemListTest.cpp
diff --git a/Source/platform/graphics/paint/DisplayItemListTest.cpp b/Source/platform/graphics/paint/DisplayItemListTest.cpp
index ef71fb1d9fd2d9171ef35488e136f555b821a084..ae69bbfd5d04d13abb8e04d3aac271162fac06ff 100644
--- a/Source/platform/graphics/paint/DisplayItemListTest.cpp
+++ b/Source/platform/graphics/paint/DisplayItemListTest.cpp
@@ -57,7 +57,7 @@ private:
class TestDisplayItem : public DisplayItem {
public:
- TestDisplayItem(const DisplayItemClientWrapper& client, Type type) : DisplayItem(client, type) { }
+ TestDisplayItem(const TestDisplayItemClient& client, Type type) : DisplayItem(client, type) { }
virtual void replay(GraphicsContext&) override final { ASSERT_NOT_REACHED(); }
virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override final { ASSERT_NOT_REACHED(); }
@@ -371,8 +371,8 @@ TEST_F(DisplayItemListTest, CachedDisplayItems)
TestDisplayItem(second, backgroundDrawingType));
EXPECT_TRUE(displayItemList().clientCacheIsValid(first.displayItemClient()));
EXPECT_TRUE(displayItemList().clientCacheIsValid(second.displayItemClient()));
- const SkPicture* firstPicture = displayItemList().displayItems()[0].picture();
- const SkPicture* secondPicture = displayItemList().displayItems()[1].picture();
+ const SkPicture* firstPicture = static_cast<const DrawingDisplayItem&>(displayItemList().displayItems()[0]).picture();
+ const SkPicture* secondPicture = static_cast<const DrawingDisplayItem&>(displayItemList().displayItems()[1]).picture();
displayItemList().invalidate(first.displayItemClient());
EXPECT_FALSE(displayItemList().clientCacheIsValid(first.displayItemClient()));
@@ -386,9 +386,9 @@ TEST_F(DisplayItemListTest, CachedDisplayItems)
TestDisplayItem(first, backgroundDrawingType),
TestDisplayItem(second, backgroundDrawingType));
// The first display item should be updated.
- EXPECT_NE(firstPicture, displayItemList().displayItems()[0].picture());
+ EXPECT_NE(firstPicture, static_cast<const DrawingDisplayItem&>(displayItemList().displayItems()[0]).picture());
// The second display item should be cached.
- EXPECT_EQ(secondPicture, displayItemList().displayItems()[1].picture());
+ EXPECT_EQ(secondPicture, static_cast<const DrawingDisplayItem&>(displayItemList().displayItems()[1]).picture());
EXPECT_TRUE(displayItemList().clientCacheIsValid(first.displayItemClient()));
EXPECT_TRUE(displayItemList().clientCacheIsValid(second.displayItemClient()));
@@ -553,12 +553,12 @@ TEST_F(DisplayItemListTest, CachedSubtreeSwapOrder)
}
#endif
-static bool isDrawing(const DisplayItems::ItemHandle& item)
+static bool isDrawing(const DisplayItem& item)
{
return DisplayItem::isDrawingType(item.type());
}
-static bool isCached(const DisplayItems::ItemHandle& item)
+static bool isCached(const DisplayItem& item)
{
return DisplayItem::isCachedType(item.type());
}
@@ -588,8 +588,8 @@ TEST_F(DisplayItemListTest, Scope)
TestDisplayItem(multicol, backgroundDrawingType),
TestDisplayItem(content, foregroundDrawingType),
TestDisplayItem(content, foregroundDrawingType));
- RefPtr<const SkPicture> picture1 = displayItemList().displayItems()[1].picture();
- RefPtr<const SkPicture> picture2 = displayItemList().displayItems()[2].picture();
+ RefPtr<const SkPicture> picture1 = static_cast<const DrawingDisplayItem&>(displayItemList().displayItems()[1]).picture();
+ RefPtr<const SkPicture> picture2 = static_cast<const DrawingDisplayItem&>(displayItemList().displayItems()[2]).picture();
EXPECT_NE(picture1, picture2);
// Draw again with nothing invalidated.
@@ -612,8 +612,8 @@ TEST_F(DisplayItemListTest, Scope)
TestDisplayItem(multicol, backgroundDrawingType),
TestDisplayItem(content, foregroundDrawingType),
TestDisplayItem(content, foregroundDrawingType));
- EXPECT_NE(picture1, displayItemList().displayItems()[1].picture());
- EXPECT_NE(picture2, displayItemList().displayItems()[2].picture());
+ EXPECT_NE(picture1, static_cast<const DrawingDisplayItem&>(displayItemList().displayItems()[1]).picture());
+ EXPECT_NE(picture2, static_cast<const DrawingDisplayItem&>(displayItemList().displayItems()[2]).picture());
// Now the multicol becomes 3 columns and repaints.
displayItemList().invalidate(multicol.displayItemClient());
@@ -643,8 +643,8 @@ TEST_F(DisplayItemListTest, Scope)
TestDisplayItem(content, foregroundDrawingType),
TestDisplayItem(content, foregroundDrawingType),
TestDisplayItem(content, foregroundDrawingType));
- EXPECT_NE(picture1, displayItemList().displayItems()[1].picture());
- EXPECT_NE(picture2, displayItemList().displayItems()[2].picture());
+ EXPECT_NE(picture1, static_cast<const DrawingDisplayItem&>(displayItemList().displayItems()[1]).picture());
+ EXPECT_NE(picture2, static_cast<const DrawingDisplayItem&>(displayItemList().displayItems()[2]).picture());
}
TEST_F(DisplayItemListTest, OptimizeNoopPairs)

Powered by Google App Engine
This is Rietveld 408576698