| Index: cc/playback/display_item_list_unittest.cc
|
| diff --git a/cc/playback/display_item_list_unittest.cc b/cc/playback/display_item_list_unittest.cc
|
| index b29baa3735e8a44ba233f87950fbd10792b77723..4d29d8a3dda9856798e4e4a5493efa9242a252cd 100644
|
| --- a/cc/playback/display_item_list_unittest.cc
|
| +++ b/cc/playback/display_item_list_unittest.cc
|
| @@ -128,8 +128,8 @@ TEST(DisplayItemListTest, SerializeSingleDrawingItem) {
|
| gfx::Size layer_size(10, 10);
|
|
|
| DisplayItemListSettings settings;
|
| - scoped_refptr<DisplayItemList> list =
|
| - DisplayItemList::Create(gfx::Rect(layer_size), settings);
|
| + settings.use_cached_picture = true;
|
| + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(settings);
|
|
|
| // Build the DrawingDisplayItem.
|
| AppendFirstSerializationTestPicture(list, layer_size);
|
| @@ -141,8 +141,8 @@ TEST(DisplayItemListTest, SerializeClipItem) {
|
| gfx::Size layer_size(10, 10);
|
|
|
| DisplayItemListSettings settings;
|
| - scoped_refptr<DisplayItemList> list =
|
| - DisplayItemList::Create(gfx::Rect(layer_size), settings);
|
| + settings.use_cached_picture = true;
|
| + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(settings);
|
|
|
| // Build the DrawingDisplayItem.
|
| AppendFirstSerializationTestPicture(list, layer_size);
|
| @@ -167,8 +167,8 @@ TEST(DisplayItemListTest, SerializeClipPathItem) {
|
| gfx::Size layer_size(10, 10);
|
|
|
| DisplayItemListSettings settings;
|
| - scoped_refptr<DisplayItemList> list =
|
| - DisplayItemList::Create(gfx::Rect(layer_size), settings);
|
| + settings.use_cached_picture = true;
|
| + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(settings);
|
|
|
| // Build the DrawingDisplayItem.
|
| AppendFirstSerializationTestPicture(list, layer_size);
|
| @@ -192,8 +192,8 @@ TEST(DisplayItemListTest, SerializeCompositingItem) {
|
| gfx::Size layer_size(10, 10);
|
|
|
| DisplayItemListSettings settings;
|
| - scoped_refptr<DisplayItemList> list =
|
| - DisplayItemList::Create(gfx::Rect(layer_size), settings);
|
| + settings.use_cached_picture = true;
|
| + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(settings);
|
|
|
| // Build the DrawingDisplayItem.
|
| AppendFirstSerializationTestPicture(list, layer_size);
|
| @@ -217,8 +217,8 @@ TEST(DisplayItemListTest, SerializeFloatClipItem) {
|
| gfx::Size layer_size(10, 10);
|
|
|
| DisplayItemListSettings settings;
|
| - scoped_refptr<DisplayItemList> list =
|
| - DisplayItemList::Create(gfx::Rect(layer_size), settings);
|
| + settings.use_cached_picture = true;
|
| + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(settings);
|
|
|
| // Build the DrawingDisplayItem.
|
| AppendFirstSerializationTestPicture(list, layer_size);
|
| @@ -241,8 +241,8 @@ TEST(DisplayItemListTest, SerializeTransformItem) {
|
| gfx::Size layer_size(10, 10);
|
|
|
| DisplayItemListSettings settings;
|
| - scoped_refptr<DisplayItemList> list =
|
| - DisplayItemList::Create(gfx::Rect(layer_size), settings);
|
| + settings.use_cached_picture = true;
|
| + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(settings);
|
|
|
| // Build the DrawingDisplayItem.
|
| AppendFirstSerializationTestPicture(list, layer_size);
|
| @@ -274,8 +274,8 @@ TEST(DisplayItemListTest, SingleDrawingItem) {
|
| red_paint.setColor(SK_ColorRED);
|
| unsigned char pixels[4 * 100 * 100] = {0};
|
| DisplayItemListSettings settings;
|
| - scoped_refptr<DisplayItemList> list =
|
| - DisplayItemList::Create(layer_rect, settings);
|
| + settings.use_cached_picture = true;
|
| + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(settings);
|
|
|
| gfx::PointF offset(8.f, 9.f);
|
| gfx::RectF recording_rect(offset, gfx::SizeF(layer_rect.size()));
|
| @@ -319,8 +319,7 @@ TEST(DisplayItemListTest, ClipItem) {
|
| unsigned char pixels[4 * 100 * 100] = {0};
|
| DisplayItemListSettings settings;
|
| settings.use_cached_picture = true;
|
| - scoped_refptr<DisplayItemList> list =
|
| - DisplayItemList::Create(layer_rect, settings);
|
| + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(settings);
|
|
|
| gfx::PointF first_offset(8.f, 9.f);
|
| gfx::RectF first_recording_rect(first_offset, gfx::SizeF(layer_rect.size()));
|
| @@ -382,8 +381,7 @@ TEST(DisplayItemListTest, TransformItem) {
|
| unsigned char pixels[4 * 100 * 100] = {0};
|
| DisplayItemListSettings settings;
|
| settings.use_cached_picture = true;
|
| - scoped_refptr<DisplayItemList> list =
|
| - DisplayItemList::Create(layer_rect, settings);
|
| + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(settings);
|
|
|
| gfx::PointF first_offset(8.f, 9.f);
|
| gfx::RectF first_recording_rect(first_offset, gfx::SizeF(layer_rect.size()));
|
| @@ -438,10 +436,8 @@ TEST(DisplayItemListTest, FilterItem) {
|
| gfx::Rect layer_rect(100, 100);
|
| FilterOperations filters;
|
| unsigned char pixels[4 * 100 * 100] = {0};
|
| - DisplayItemListSettings settings;
|
| - settings.use_cached_picture = true;
|
| scoped_refptr<DisplayItemList> list =
|
| - DisplayItemList::Create(layer_rect, settings);
|
| + DisplayItemList::Create(DisplayItemListSettings());
|
|
|
| skia::RefPtr<SkSurface> source_surface =
|
| skia::AdoptRef(SkSurface::NewRasterN32Premul(50, 50));
|
| @@ -501,9 +497,8 @@ TEST(DisplayItemListTest, CompactingItems) {
|
| gfx::RectF recording_rect(offset, gfx::SizeF(layer_rect.size()));
|
|
|
| DisplayItemListSettings no_caching_settings;
|
| - no_caching_settings.use_cached_picture = false;
|
| scoped_refptr<DisplayItemList> list_without_caching =
|
| - DisplayItemList::Create(layer_rect, no_caching_settings);
|
| + DisplayItemList::Create(no_caching_settings);
|
|
|
| canvas = skia::SharePtr(
|
| recorder.beginRecording(gfx::RectFToSkRect(recording_rect)));
|
| @@ -521,7 +516,7 @@ TEST(DisplayItemListTest, CompactingItems) {
|
| DisplayItemListSettings caching_settings;
|
| caching_settings.use_cached_picture = true;
|
| scoped_refptr<DisplayItemList> list_with_caching =
|
| - DisplayItemList::Create(layer_rect, caching_settings);
|
| + DisplayItemList::Create(caching_settings);
|
| auto* item2 =
|
| list_with_caching->CreateAndAppendItem<DrawingDisplayItem>(kVisualRect);
|
| item2->SetNew(picture);
|
| @@ -531,71 +526,6 @@ TEST(DisplayItemListTest, CompactingItems) {
|
| EXPECT_EQ(0, memcmp(pixels, expected_pixels, 4 * 100 * 100));
|
| }
|
|
|
| -TEST(DisplayItemListTest, IsSuitableForGpuRasterizationWithCachedPicture) {
|
| - gfx::Rect layer_rect(1000, 1000);
|
| - SkPictureRecorder recorder;
|
| - skia::RefPtr<SkCanvas> canvas;
|
| - skia::RefPtr<SkPicture> picture;
|
| -
|
| - DisplayItemListSettings settings;
|
| - settings.use_cached_picture = true;
|
| - scoped_refptr<DisplayItemList> list =
|
| - DisplayItemList::Create(layer_rect, settings);
|
| - canvas =
|
| - skia::SharePtr(recorder.beginRecording(gfx::RectToSkRect(layer_rect)));
|
| -
|
| - SkPath path;
|
| - path.moveTo(0, 0);
|
| - path.lineTo(0, 100);
|
| - path.lineTo(50, 50);
|
| - path.lineTo(100, 100);
|
| - path.lineTo(100, 0);
|
| - path.close();
|
| -
|
| - SkPaint paint;
|
| - paint.setAntiAlias(true);
|
| - canvas->drawPath(path, paint);
|
| -
|
| - picture = skia::AdoptRef(recorder.endRecordingAsPicture());
|
| - DrawingDisplayItem* item =
|
| - list->CreateAndAppendItem<DrawingDisplayItem>(kVisualRect);
|
| - item->SetNew(picture);
|
| - list->Finalize();
|
| -
|
| - // A single DrawingDisplayItem with a large AA concave path shouldn't trigger
|
| - // a veto.
|
| - EXPECT_TRUE(list->IsSuitableForGpuRasterization());
|
| -
|
| - list = DisplayItemList::Create(layer_rect, settings);
|
| - canvas =
|
| - skia::SharePtr(recorder.beginRecording(gfx::RectToSkRect(layer_rect)));
|
| - for (int i = 0; i < 10; ++i)
|
| - canvas->drawPath(path, paint);
|
| - picture = skia::AdoptRef(recorder.endRecordingAsPicture());
|
| - item = list->CreateAndAppendItem<DrawingDisplayItem>(kVisualRect);
|
| - item->SetNew(picture);
|
| - list->Finalize();
|
| -
|
| - // A single DrawingDisplayItem with several large AA concave paths should
|
| - // trigger a veto.
|
| - EXPECT_FALSE(list->IsSuitableForGpuRasterization());
|
| -
|
| - list = DisplayItemList::Create(layer_rect, settings);
|
| - for (int i = 0; i < 10; ++i) {
|
| - canvas =
|
| - skia::SharePtr(recorder.beginRecording(gfx::RectToSkRect(layer_rect)));
|
| - canvas->drawPath(path, paint);
|
| - picture = skia::AdoptRef(recorder.endRecordingAsPicture());
|
| - item = list->CreateAndAppendItem<DrawingDisplayItem>(kVisualRect);
|
| - item->SetNew(picture);
|
| - }
|
| - list->Finalize();
|
| -
|
| - // Having several DrawingDisplayItems that each contain a large AA concave
|
| - // path should trigger a veto.
|
| - EXPECT_FALSE(list->IsSuitableForGpuRasterization());
|
| -}
|
| -
|
| TEST(DisplayItemListTest, IsSuitableForGpuRasterizationWithoutCachedPicture) {
|
| gfx::Rect layer_rect(1000, 1000);
|
| SkPictureRecorder recorder;
|
| @@ -604,8 +534,7 @@ TEST(DisplayItemListTest, IsSuitableForGpuRasterizationWithoutCachedPicture) {
|
|
|
| DisplayItemListSettings settings;
|
| settings.use_cached_picture = false;
|
| - scoped_refptr<DisplayItemList> list =
|
| - DisplayItemList::Create(layer_rect, settings);
|
| + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(settings);
|
| canvas =
|
| skia::SharePtr(recorder.beginRecording(gfx::RectToSkRect(layer_rect)));
|
|
|
| @@ -631,7 +560,7 @@ TEST(DisplayItemListTest, IsSuitableForGpuRasterizationWithoutCachedPicture) {
|
| // a veto.
|
| EXPECT_TRUE(list->IsSuitableForGpuRasterization());
|
|
|
| - list = DisplayItemList::Create(layer_rect, settings);
|
| + list = DisplayItemList::Create(settings);
|
| canvas =
|
| skia::SharePtr(recorder.beginRecording(gfx::RectToSkRect(layer_rect)));
|
| for (int i = 0; i < 10; ++i)
|
| @@ -645,7 +574,7 @@ TEST(DisplayItemListTest, IsSuitableForGpuRasterizationWithoutCachedPicture) {
|
| // trigger a veto.
|
| EXPECT_FALSE(list->IsSuitableForGpuRasterization());
|
|
|
| - list = DisplayItemList::Create(layer_rect, settings);
|
| + list = DisplayItemList::Create(settings);
|
| for (int i = 0; i < 10; ++i) {
|
| canvas =
|
| skia::SharePtr(recorder.beginRecording(gfx::RectToSkRect(layer_rect)));
|
| @@ -683,7 +612,7 @@ TEST(DisplayItemListTest, ApproximateMemoryUsage) {
|
| // Using a cached picture, we should get about the right size.
|
| DisplayItemListSettings caching_settings;
|
| caching_settings.use_cached_picture = true;
|
| - list = DisplayItemList::Create(layer_rect, caching_settings);
|
| + list = DisplayItemList::Create(caching_settings);
|
| auto* item = list->CreateAndAppendItem<DrawingDisplayItem>(kVisualRect);
|
| item->SetNew(picture);
|
| list->Finalize();
|
| @@ -694,23 +623,13 @@ TEST(DisplayItemListTest, ApproximateMemoryUsage) {
|
| // Using no cached picture, we should still get the right size.
|
| DisplayItemListSettings no_caching_settings;
|
| no_caching_settings.use_cached_picture = false;
|
| - list = DisplayItemList::Create(layer_rect, no_caching_settings);
|
| + list = DisplayItemList::Create(no_caching_settings);
|
| item = list->CreateAndAppendItem<DrawingDisplayItem>(kVisualRect);
|
| item->SetNew(picture);
|
| list->Finalize();
|
| memory_usage = list->ApproximateMemoryUsage();
|
| EXPECT_GE(memory_usage, picture_size);
|
| EXPECT_LE(memory_usage, 2 * picture_size);
|
| -
|
| - // To avoid double counting, we expect zero size to be computed if both the
|
| - // picture and items are retained (currently this only happens due to certain
|
| - // categories being traced).
|
| - list = new DisplayItemList(layer_rect, caching_settings, true);
|
| - item = list->CreateAndAppendItem<DrawingDisplayItem>(kVisualRect);
|
| - item->SetNew(picture);
|
| - list->Finalize();
|
| - memory_usage = list->ApproximateMemoryUsage();
|
| - EXPECT_EQ(static_cast<size_t>(0), memory_usage);
|
| }
|
|
|
| } // namespace cc
|
|
|