Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/graphics/paint/PaintController.h" | 5 #include "platform/graphics/paint/PaintController.h" |
| 6 | 6 |
| 7 #include "platform/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
| 8 #include "platform/graphics/GraphicsContext.h" | 8 #include "platform/graphics/GraphicsContext.h" |
| 9 #include "platform/graphics/paint/ClipPathDisplayItem.h" | 9 #include "platform/graphics/paint/ClipPathDisplayItem.h" |
| 10 #include "platform/graphics/paint/ClipPathRecorder.h" | 10 #include "platform/graphics/paint/ClipPathRecorder.h" |
| (...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1076 FloatRect(100, 200, 100, 100)); | 1076 FloatRect(100, 200, 100, 100)); |
| 1077 drawRect(context, content2, backgroundDrawingType, | 1077 drawRect(context, content2, backgroundDrawingType, |
| 1078 FloatRect(100, 200, 50, 200)); | 1078 FloatRect(100, 200, 50, 200)); |
| 1079 drawRect(context, content2, foregroundDrawingType, | 1079 drawRect(context, content2, foregroundDrawingType, |
| 1080 FloatRect(100, 200, 50, 200)); | 1080 FloatRect(100, 200, 50, 200)); |
| 1081 drawRect(context, container2, foregroundDrawingType, | 1081 drawRect(context, container2, foregroundDrawingType, |
| 1082 FloatRect(100, 200, 100, 100)); | 1082 FloatRect(100, 200, 100, 100)); |
| 1083 } | 1083 } |
| 1084 getPaintController().commitNewDisplayItems(); | 1084 getPaintController().commitNewDisplayItems(); |
| 1085 | 1085 |
| 1086 EXPECT_DISPLAY_LIST( | 1086 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 8, |
| 1087 getPaintController().getDisplayItemList(), 12, | 1087 TestDisplayItem(container1, backgroundDrawingType), |
| 1088 TestDisplayItem(container1, DisplayItem::kSubsequence), | 1088 TestDisplayItem(content1, backgroundDrawingType), |
| 1089 TestDisplayItem(container1, backgroundDrawingType), | 1089 TestDisplayItem(content1, foregroundDrawingType), |
| 1090 TestDisplayItem(content1, backgroundDrawingType), | 1090 TestDisplayItem(container1, foregroundDrawingType), |
| 1091 TestDisplayItem(content1, foregroundDrawingType), | |
| 1092 TestDisplayItem(container1, foregroundDrawingType), | |
| 1093 TestDisplayItem(container1, DisplayItem::kEndSubsequence), | |
| 1094 | 1091 |
| 1095 TestDisplayItem(container2, DisplayItem::kSubsequence), | 1092 TestDisplayItem(container2, backgroundDrawingType), |
| 1096 TestDisplayItem(container2, backgroundDrawingType), | 1093 TestDisplayItem(content2, backgroundDrawingType), |
| 1097 TestDisplayItem(content2, backgroundDrawingType), | 1094 TestDisplayItem(content2, foregroundDrawingType), |
| 1098 TestDisplayItem(content2, foregroundDrawingType), | 1095 TestDisplayItem(container2, foregroundDrawingType)); |
| 1099 TestDisplayItem(container2, foregroundDrawingType), | 1096 |
| 1100 TestDisplayItem(container2, DisplayItem::kEndSubsequence)); | 1097 PaintController::SubsequenceMarkers* markers = |
| 1098 getPaintController().getSubsequenceMarkers(container1); | |
| 1099 CHECK(markers); | |
| 1100 EXPECT_EQ(0ull, markers->start); | |
| 1101 EXPECT_EQ(3ull, markers->end); | |
| 1102 | |
| 1103 markers = getPaintController().getSubsequenceMarkers(container2); | |
| 1104 CHECK(markers); | |
| 1105 EXPECT_EQ(4ull, markers->start); | |
| 1106 EXPECT_EQ(7ull, markers->end); | |
| 1101 | 1107 |
| 1102 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1108 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 1103 EXPECT_EQ(2u, getPaintController().paintChunks().size()); | 1109 EXPECT_EQ(2u, getPaintController().paintChunks().size()); |
| 1104 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), | 1110 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), |
| 1105 getPaintController().paintChunks()[0].id); | 1111 getPaintController().paintChunks()[0].id); |
| 1106 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), | 1112 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), |
| 1107 getPaintController().paintChunks()[1].id); | 1113 getPaintController().paintChunks()[1].id); |
| 1108 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects, | 1114 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects, |
| 1109 UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); | 1115 UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); |
| 1110 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRects, | 1116 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRects, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1153 drawRect(context, container1, foregroundDrawingType, | 1159 drawRect(context, container1, foregroundDrawingType, |
| 1154 FloatRect(100, 100, 100, 100)); | 1160 FloatRect(100, 100, 100, 100)); |
| 1155 } | 1161 } |
| 1156 } else { | 1162 } else { |
| 1157 EXPECT_TRUE(SubsequenceRecorder::useCachedSubsequenceIfPossible( | 1163 EXPECT_TRUE(SubsequenceRecorder::useCachedSubsequenceIfPossible( |
| 1158 context, container2)); | 1164 context, container2)); |
| 1159 EXPECT_TRUE(SubsequenceRecorder::useCachedSubsequenceIfPossible( | 1165 EXPECT_TRUE(SubsequenceRecorder::useCachedSubsequenceIfPossible( |
| 1160 context, container1)); | 1166 context, container1)); |
| 1161 } | 1167 } |
| 1162 | 1168 |
| 1163 EXPECT_EQ(12, numCachedNewItems()); | 1169 EXPECT_EQ(8, numCachedNewItems()); |
| 1164 #ifndef NDEBUG | 1170 #ifndef NDEBUG |
| 1165 EXPECT_EQ(1, numSequentialMatches()); | 1171 EXPECT_EQ(0, numSequentialMatches()); |
|
chrishtr
2017/04/04 18:12:48
I'm not quite sure these are correct. Could you ch
Xianzhu
2017/04/05 22:39:17
These look good if stat of subsequences are exclud
| |
| 1166 EXPECT_EQ(1, numOutOfOrderMatches()); | 1172 EXPECT_EQ(0, numOutOfOrderMatches()); |
| 1167 EXPECT_EQ(5, numIndexedItems()); | 1173 EXPECT_EQ(0, numIndexedItems()); |
| 1168 #endif | 1174 #endif |
| 1169 | 1175 |
| 1170 getPaintController().commitNewDisplayItems(); | 1176 getPaintController().commitNewDisplayItems(); |
| 1171 | 1177 |
| 1172 EXPECT_DISPLAY_LIST( | 1178 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 8, |
| 1173 getPaintController().getDisplayItemList(), 12, | 1179 TestDisplayItem(container2, backgroundDrawingType), |
| 1174 TestDisplayItem(container2, DisplayItem::kSubsequence), | 1180 TestDisplayItem(content2, backgroundDrawingType), |
| 1175 TestDisplayItem(container2, backgroundDrawingType), | 1181 TestDisplayItem(content2, foregroundDrawingType), |
| 1176 TestDisplayItem(content2, backgroundDrawingType), | 1182 TestDisplayItem(container2, foregroundDrawingType), |
| 1177 TestDisplayItem(content2, foregroundDrawingType), | 1183 TestDisplayItem(container1, backgroundDrawingType), |
| 1178 TestDisplayItem(container2, foregroundDrawingType), | 1184 TestDisplayItem(content1, backgroundDrawingType), |
| 1179 TestDisplayItem(container2, DisplayItem::kEndSubsequence), | 1185 TestDisplayItem(content1, foregroundDrawingType), |
| 1186 TestDisplayItem(container1, foregroundDrawingType)); | |
| 1180 | 1187 |
| 1181 TestDisplayItem(container1, DisplayItem::kSubsequence), | 1188 markers = getPaintController().getSubsequenceMarkers(container2); |
| 1182 TestDisplayItem(container1, backgroundDrawingType), | 1189 CHECK(markers); |
| 1183 TestDisplayItem(content1, backgroundDrawingType), | 1190 EXPECT_EQ(0ull, markers->start); |
| 1184 TestDisplayItem(content1, foregroundDrawingType), | 1191 EXPECT_EQ(3ull, markers->end); |
| 1185 TestDisplayItem(container1, foregroundDrawingType), | 1192 |
| 1186 TestDisplayItem(container1, DisplayItem::kEndSubsequence)); | 1193 markers = getPaintController().getSubsequenceMarkers(container1); |
| 1194 CHECK(markers); | |
| 1195 EXPECT_EQ(4ull, markers->start); | |
| 1196 EXPECT_EQ(7ull, markers->end); | |
| 1187 | 1197 |
| 1188 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 1198 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 1189 DisplayItemClient::endShouldKeepAliveAllClients(); | 1199 DisplayItemClient::endShouldKeepAliveAllClients(); |
| 1190 #endif | 1200 #endif |
| 1191 | 1201 |
| 1192 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1202 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 1193 EXPECT_EQ(2u, getPaintController().paintChunks().size()); | 1203 EXPECT_EQ(2u, getPaintController().paintChunks().size()); |
| 1194 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), | 1204 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), |
| 1195 getPaintController().paintChunks()[0].id); | 1205 getPaintController().paintChunks()[0].id); |
| 1196 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), | 1206 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1419 getPaintController().updateCurrentPaintChunkProperties( | 1429 getPaintController().updateCurrentPaintChunkProperties( |
| 1420 &id, content2Properties); | 1430 &id, content2Properties); |
| 1421 } | 1431 } |
| 1422 SubsequenceRecorder r(context, content2); | 1432 SubsequenceRecorder r(context, content2); |
| 1423 drawRect(context, content2, backgroundDrawingType, | 1433 drawRect(context, content2, backgroundDrawingType, |
| 1424 FloatRect(100, 200, 50, 200)); | 1434 FloatRect(100, 200, 50, 200)); |
| 1425 } | 1435 } |
| 1426 } | 1436 } |
| 1427 getPaintController().commitNewDisplayItems(); | 1437 getPaintController().commitNewDisplayItems(); |
| 1428 | 1438 |
| 1429 EXPECT_DISPLAY_LIST( | 1439 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 6, |
| 1430 getPaintController().getDisplayItemList(), 14, | 1440 TestDisplayItem(container1, backgroundDrawingType), |
| 1431 TestDisplayItem(container1, DisplayItem::kSubsequence), | 1441 TestDisplayItem(content1, backgroundDrawingType), |
| 1432 TestDisplayItem(container1, backgroundDrawingType), | 1442 TestDisplayItem(content1, foregroundDrawingType), |
| 1433 TestDisplayItem(content1, DisplayItem::kSubsequence), | 1443 TestDisplayItem(container1, foregroundDrawingType), |
| 1434 TestDisplayItem(content1, backgroundDrawingType), | 1444 TestDisplayItem(container2, backgroundDrawingType), |
| 1435 TestDisplayItem(content1, foregroundDrawingType), | 1445 TestDisplayItem(content2, backgroundDrawingType)); |
| 1436 TestDisplayItem(content1, DisplayItem::kEndSubsequence), | |
| 1437 TestDisplayItem(container1, foregroundDrawingType), | |
| 1438 TestDisplayItem(container1, DisplayItem::kEndSubsequence), | |
| 1439 | 1446 |
| 1440 TestDisplayItem(container2, DisplayItem::kSubsequence), | 1447 PaintController::SubsequenceMarkers* markers = |
| 1441 TestDisplayItem(container2, backgroundDrawingType), | 1448 getPaintController().getSubsequenceMarkers(container1); |
| 1442 TestDisplayItem(content2, DisplayItem::kSubsequence), | 1449 CHECK(markers); |
| 1443 TestDisplayItem(content2, backgroundDrawingType), | 1450 EXPECT_EQ(0ull, markers->start); |
| 1444 TestDisplayItem(content2, DisplayItem::kEndSubsequence), | 1451 EXPECT_EQ(3ull, markers->end); |
| 1445 TestDisplayItem(container2, DisplayItem::kEndSubsequence)); | 1452 |
| 1453 markers = getPaintController().getSubsequenceMarkers(content1); | |
| 1454 CHECK(markers); | |
| 1455 EXPECT_EQ(1ull, markers->start); | |
| 1456 EXPECT_EQ(2ull, markers->end); | |
| 1457 | |
| 1458 markers = getPaintController().getSubsequenceMarkers(container2); | |
| 1459 CHECK(markers); | |
| 1460 EXPECT_EQ(4ull, markers->start); | |
| 1461 EXPECT_EQ(5ull, markers->end); | |
| 1462 | |
| 1463 markers = getPaintController().getSubsequenceMarkers(content2); | |
| 1464 CHECK(markers); | |
| 1465 EXPECT_EQ(5ull, markers->start); | |
| 1466 EXPECT_EQ(5ull, markers->end); | |
| 1446 | 1467 |
| 1447 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1468 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 1448 EXPECT_EQ(5u, getPaintController().paintChunks().size()); | 1469 EXPECT_EQ(5u, getPaintController().paintChunks().size()); |
| 1449 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), | 1470 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), |
| 1450 getPaintController().paintChunks()[0].id); | 1471 getPaintController().paintChunks()[0].id); |
| 1451 EXPECT_EQ(PaintChunk::Id(content1, backgroundDrawingType), | 1472 EXPECT_EQ(PaintChunk::Id(content1, backgroundDrawingType), |
| 1452 getPaintController().paintChunks()[1].id); | 1473 getPaintController().paintChunks()[1].id); |
| 1453 EXPECT_EQ(PaintChunk::Id(container1, foregroundDrawingType), | 1474 EXPECT_EQ(PaintChunk::Id(container1, foregroundDrawingType), |
| 1454 getPaintController().paintChunks()[2].id); | 1475 getPaintController().paintChunks()[2].id); |
| 1455 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), | 1476 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1519 } | 1540 } |
| 1520 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1541 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 1521 PaintChunk::Id id(container1, foregroundDrawingType); | 1542 PaintChunk::Id id(container1, foregroundDrawingType); |
| 1522 getPaintController().updateCurrentPaintChunkProperties( | 1543 getPaintController().updateCurrentPaintChunkProperties( |
| 1523 &id, container1ForegroundProperties); | 1544 &id, container1ForegroundProperties); |
| 1524 } | 1545 } |
| 1525 drawRect(context, container1, foregroundDrawingType, | 1546 drawRect(context, container1, foregroundDrawingType, |
| 1526 FloatRect(100, 100, 100, 100)); | 1547 FloatRect(100, 100, 100, 100)); |
| 1527 } | 1548 } |
| 1528 | 1549 |
| 1529 EXPECT_EQ(4, numCachedNewItems()); | 1550 EXPECT_EQ(2, numCachedNewItems()); |
| 1530 #ifndef NDEBUG | 1551 #ifndef NDEBUG |
| 1531 EXPECT_EQ(1, numSequentialMatches()); | 1552 EXPECT_EQ(0, numSequentialMatches()); |
|
chrishtr
2017/04/04 18:12:48
I'm not quite sure these are correct. Could you ch
| |
| 1532 EXPECT_EQ(0, numOutOfOrderMatches()); | 1553 EXPECT_EQ(0, numOutOfOrderMatches()); |
| 1533 EXPECT_EQ(2, numIndexedItems()); | 1554 EXPECT_EQ(0, numIndexedItems()); |
| 1534 #endif | 1555 #endif |
| 1535 | 1556 |
| 1536 getPaintController().commitNewDisplayItems(); | 1557 getPaintController().commitNewDisplayItems(); |
| 1537 | 1558 |
| 1538 EXPECT_DISPLAY_LIST( | 1559 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 4, |
| 1539 getPaintController().getDisplayItemList(), 10, | 1560 TestDisplayItem(content2, foregroundDrawingType), |
| 1540 TestDisplayItem(content2, DisplayItem::kSubsequence), | 1561 TestDisplayItem(content1, backgroundDrawingType), |
| 1541 TestDisplayItem(content2, foregroundDrawingType), | 1562 TestDisplayItem(content1, foregroundDrawingType), |
| 1542 TestDisplayItem(content2, DisplayItem::kEndSubsequence), | 1563 TestDisplayItem(container1, foregroundDrawingType)); |
| 1543 | 1564 |
| 1544 TestDisplayItem(container1, DisplayItem::kSubsequence), | 1565 markers = getPaintController().getSubsequenceMarkers(content2); |
| 1545 TestDisplayItem(content1, DisplayItem::kSubsequence), | 1566 CHECK(markers); |
| 1546 TestDisplayItem(content1, backgroundDrawingType), | 1567 EXPECT_EQ(0ull, markers->start); |
| 1547 TestDisplayItem(content1, foregroundDrawingType), | 1568 EXPECT_EQ(0ull, markers->end); |
| 1548 TestDisplayItem(content1, DisplayItem::kEndSubsequence), | 1569 |
| 1549 TestDisplayItem(container1, foregroundDrawingType), | 1570 markers = getPaintController().getSubsequenceMarkers(container1); |
| 1550 TestDisplayItem(container1, DisplayItem::kEndSubsequence)); | 1571 CHECK(markers); |
| 1572 EXPECT_EQ(1ull, markers->start); | |
| 1573 EXPECT_EQ(3ull, markers->end); | |
| 1574 | |
| 1575 markers = getPaintController().getSubsequenceMarkers(content1); | |
| 1576 CHECK(markers); | |
| 1577 EXPECT_EQ(1ull, markers->start); | |
| 1578 EXPECT_EQ(2ull, markers->end); | |
| 1551 | 1579 |
| 1552 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1580 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 1553 EXPECT_EQ(3u, getPaintController().paintChunks().size()); | 1581 EXPECT_EQ(3u, getPaintController().paintChunks().size()); |
| 1554 EXPECT_EQ(PaintChunk::Id(content2, foregroundDrawingType), | 1582 EXPECT_EQ(PaintChunk::Id(content2, foregroundDrawingType), |
| 1555 getPaintController().paintChunks()[0].id); | 1583 getPaintController().paintChunks()[0].id); |
| 1556 EXPECT_EQ(PaintChunk::Id(content1, backgroundDrawingType), | 1584 EXPECT_EQ(PaintChunk::Id(content1, backgroundDrawingType), |
| 1557 getPaintController().paintChunks()[1].id); | 1585 getPaintController().paintChunks()[1].id); |
| 1558 EXPECT_EQ(PaintChunk::Id(container1, foregroundDrawingType), | 1586 EXPECT_EQ(PaintChunk::Id(container1, foregroundDrawingType), |
| 1559 getPaintController().paintChunks()[2].id); | 1587 getPaintController().paintChunks()[2].id); |
| 1560 // This is a new chunk. | 1588 // This is a new chunk. |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 1591 | 1619 |
| 1592 drawRect(context, multicol, backgroundDrawingType, | 1620 drawRect(context, multicol, backgroundDrawingType, |
| 1593 FloatRect(100, 200, 100, 100)); | 1621 FloatRect(100, 200, 100, 100)); |
| 1594 | 1622 |
| 1595 getPaintController().beginSkippingCache(); | 1623 getPaintController().beginSkippingCache(); |
| 1596 drawRect(context, content, foregroundDrawingType, rect1); | 1624 drawRect(context, content, foregroundDrawingType, rect1); |
| 1597 drawRect(context, content, foregroundDrawingType, rect2); | 1625 drawRect(context, content, foregroundDrawingType, rect2); |
| 1598 getPaintController().endSkippingCache(); | 1626 getPaintController().endSkippingCache(); |
| 1599 | 1627 |
| 1600 getPaintController().commitNewDisplayItems(); | 1628 getPaintController().commitNewDisplayItems(); |
| 1601 | |
| 1602 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3, | 1629 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3, |
| 1603 TestDisplayItem(multicol, backgroundDrawingType), | 1630 TestDisplayItem(multicol, backgroundDrawingType), |
| 1604 TestDisplayItem(content, foregroundDrawingType), | 1631 TestDisplayItem(content, foregroundDrawingType), |
| 1605 TestDisplayItem(content, foregroundDrawingType)); | 1632 TestDisplayItem(content, foregroundDrawingType)); |
| 1606 sk_sp<const PaintRecord> record1 = | 1633 sk_sp<const PaintRecord> record1 = |
| 1607 static_cast<const DrawingDisplayItem&>( | 1634 static_cast<const DrawingDisplayItem&>( |
| 1608 getPaintController().getDisplayItemList()[1]) | 1635 getPaintController().getDisplayItemList()[1]) |
| 1609 .GetPaintRecord(); | 1636 .GetPaintRecord(); |
| 1610 sk_sp<const PaintRecord> record2 = | 1637 sk_sp<const PaintRecord> record2 = |
| 1611 static_cast<const DrawingDisplayItem&>( | 1638 static_cast<const DrawingDisplayItem&>( |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2234 FakeDisplayItemClient content("content"); | 2261 FakeDisplayItemClient content("content"); |
| 2235 GraphicsContext context(getPaintController()); | 2262 GraphicsContext context(getPaintController()); |
| 2236 | 2263 |
| 2237 { | 2264 { |
| 2238 SubsequenceRecorder subsequence(context, container); | 2265 SubsequenceRecorder subsequence(context, container); |
| 2239 CompositingRecorder compositing(context, content, SkBlendMode::kSrc, 0.5); | 2266 CompositingRecorder compositing(context, content, SkBlendMode::kSrc, 0.5); |
| 2240 drawRect(context, content, backgroundDrawingType, | 2267 drawRect(context, content, backgroundDrawingType, |
| 2241 FloatRect(100, 100, 300, 300)); | 2268 FloatRect(100, 100, 300, 300)); |
| 2242 } | 2269 } |
| 2243 getPaintController().commitNewDisplayItems(); | 2270 getPaintController().commitNewDisplayItems(); |
| 2244 EXPECT_EQ(3u, | 2271 EXPECT_EQ(1u, |
| 2245 getPaintController().paintArtifact().getDisplayItemList().size()); | 2272 getPaintController().paintArtifact().getDisplayItemList().size()); |
| 2246 | 2273 |
| 2247 { | 2274 { |
| 2248 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible( | 2275 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible( |
| 2249 context, container)); | 2276 context, container)); |
| 2250 SubsequenceRecorder subsequence(context, container); | 2277 SubsequenceRecorder subsequence(context, container); |
| 2251 CompositingRecorder compositing(context, content, SkBlendMode::kSrc, 0.5); | 2278 CompositingRecorder compositing(context, content, SkBlendMode::kSrc, 0.5); |
| 2252 drawRect(context, content, backgroundDrawingType, | 2279 drawRect(context, content, backgroundDrawingType, |
| 2253 FloatRect(100, 100, 300, 300)); | 2280 FloatRect(100, 100, 300, 300)); |
| 2254 } | 2281 } |
| 2255 getPaintController().commitNewDisplayItems(); | 2282 getPaintController().commitNewDisplayItems(); |
| 2256 EXPECT_EQ(3u, | 2283 EXPECT_EQ(1u, |
| 2257 getPaintController().paintArtifact().getDisplayItemList().size()); | 2284 getPaintController().paintArtifact().getDisplayItemList().size()); |
| 2258 | 2285 |
| 2259 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 2286 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 2260 DisplayItemClient::endShouldKeepAliveAllClients(); | 2287 DisplayItemClient::endShouldKeepAliveAllClients(); |
| 2261 #endif | 2288 #endif |
| 2262 } | 2289 } |
| 2263 }; | 2290 }; |
| 2264 | 2291 |
| 2265 TEST_F(PaintControllerUnderInvalidationTest, ChangeDrawing) { | 2292 TEST_F(PaintControllerUnderInvalidationTest, ChangeDrawing) { |
| 2266 EXPECT_DEATH(testChangeDrawing(), "under-invalidation: display item changed"); | 2293 EXPECT_DEATH(testChangeDrawing(), "under-invalidation: display item changed"); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 2285 | 2312 |
| 2286 TEST_F(PaintControllerUnderInvalidationTest, ChangeDrawingInSubsequence) { | 2313 TEST_F(PaintControllerUnderInvalidationTest, ChangeDrawingInSubsequence) { |
| 2287 EXPECT_DEATH(testChangeDrawingInSubsequence(), | 2314 EXPECT_DEATH(testChangeDrawingInSubsequence(), |
| 2288 "\"\\(In cached subsequence of first\\)\" under-invalidation: " | 2315 "\"\\(In cached subsequence of first\\)\" under-invalidation: " |
| 2289 "display item changed"); | 2316 "display item changed"); |
| 2290 } | 2317 } |
| 2291 | 2318 |
| 2292 TEST_F(PaintControllerUnderInvalidationTest, MoreDrawingInSubsequence) { | 2319 TEST_F(PaintControllerUnderInvalidationTest, MoreDrawingInSubsequence) { |
| 2293 EXPECT_DEATH(testMoreDrawingInSubsequence(), | 2320 EXPECT_DEATH(testMoreDrawingInSubsequence(), |
| 2294 "\"\\(In cached subsequence of first\\)\" under-invalidation: " | 2321 "\"\\(In cached subsequence of first\\)\" under-invalidation: " |
| 2295 "display item changed"); | 2322 "new subsequence wrong length"); |
| 2296 } | 2323 } |
| 2297 | 2324 |
| 2298 TEST_F(PaintControllerUnderInvalidationTest, LessDrawingInSubsequence) { | 2325 TEST_F(PaintControllerUnderInvalidationTest, LessDrawingInSubsequence) { |
| 2326 // We allow invalidated display item clients as long as they would produce the | |
| 2327 // same display items. The cases of changed display items are tested by other | |
| 2328 // test cases. | |
| 2299 EXPECT_DEATH(testLessDrawingInSubsequence(), | 2329 EXPECT_DEATH(testLessDrawingInSubsequence(), |
| 2300 "\"\\(In cached subsequence of first\\)\" under-invalidation: " | 2330 "\"\\(In cached subsequence of first\\)\" under-invalidation: " |
| 2301 "display item changed"); | 2331 "new subsequence wrong length"); |
| 2302 } | 2332 } |
| 2303 | 2333 |
| 2304 TEST_F(PaintControllerUnderInvalidationTest, ChangeNonCacheableInSubsequence) { | 2334 TEST_F(PaintControllerUnderInvalidationTest, ChangeNonCacheableInSubsequence) { |
| 2305 EXPECT_DEATH(testChangeNonCacheableInSubsequence(), | 2335 EXPECT_DEATH(testChangeNonCacheableInSubsequence(), |
| 2306 "\"\\(In cached subsequence of container\\)\" " | 2336 "\"\\(In cached subsequence of container\\)\" " |
| 2307 "under-invalidation: display item changed"); | 2337 "under-invalidation: display item changed"); |
| 2308 } | 2338 } |
| 2309 | 2339 |
| 2310 TEST_F(PaintControllerUnderInvalidationTest, InvalidationInSubsequence) { | 2340 TEST_F(PaintControllerUnderInvalidationTest, InvalidationInSubsequence) { |
| 2311 // We allow invalidated display item clients as long as they would produce the | 2341 // We allow invalidated display item clients as long as they would produce the |
| 2312 // same display items. The cases of changed display items are tested by other | 2342 // same display items. The cases of changed display items are tested by other |
| 2313 // test cases. | 2343 // test cases. |
| 2314 testInvalidationInSubsequence(); | 2344 testInvalidationInSubsequence(); |
| 2315 } | 2345 } |
| 2316 | 2346 |
| 2317 TEST_F(PaintControllerUnderInvalidationTest, | 2347 TEST_F(PaintControllerUnderInvalidationTest, |
| 2318 FoldCompositingDrawingInSubsequence) { | 2348 FoldCompositingDrawingInSubsequence) { |
| 2319 testFoldCompositingDrawingInSubsequence(); | 2349 testFoldCompositingDrawingInSubsequence(); |
| 2320 } | 2350 } |
| 2321 | 2351 |
| 2322 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) | 2352 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) |
| 2323 | 2353 |
| 2324 } // namespace blink | 2354 } // namespace blink |
| OLD | NEW |