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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 2141233002: cc: Clean up RecordingSource API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address vmpstr's comments Created 4 years, 5 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: cc/layers/picture_layer_impl_unittest.cc
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index 70face09ca7790c622e8c82dd4ac278ce3295291..d2053f9580b9f0ba720f469c45f140f961dc69a1 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -4309,6 +4309,22 @@ TEST_F(PictureLayerImplTest, PendingOrActiveTwinLayer) {
EXPECT_FALSE(active_layer()->GetPendingOrActiveTwinLayer());
}
+void GetClientDataAndUpdateInvalidation(RecordingSource* recording_source,
+ FakeContentLayerClient* client,
+ Region invalidation,
+ gfx::Size layer_bounds) {
+ gfx::Rect new_recorded_viewport = client->PaintableRegion();
+ scoped_refptr<DisplayItemList> display_list =
+ client->PaintContentsToDisplayList(
+ ContentLayerClient::PAINTING_BEHAVIOR_NORMAL);
+ size_t painter_reported_memory_usage =
+ client->GetApproximateUnsharedMemoryUsage();
+
+ recording_source->UpdateAndExpandInvalidation(
+ client, &invalidation, layer_bounds, new_recorded_viewport, display_list,
+ painter_reported_memory_usage);
+}
+
void PictureLayerImplTest::TestQuadsForSolidColor(bool test_for_solid) {
host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
@@ -4326,14 +4342,12 @@ void PictureLayerImplTest::TestQuadsForSolidColor(bool test_for_solid) {
host->SetRootLayer(layer);
RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
- int frame_number = 0;
-
client.set_fill_with_nonsolid_color(!test_for_solid);
Region invalidation(layer_rect);
- recording_source->UpdateAndExpandInvalidation(
- &client, &invalidation, layer_bounds, frame_number++,
- RecordingSource::RECORD_NORMALLY);
+
+ GetClientDataAndUpdateInvalidation(recording_source, &client, invalidation,
+ layer_bounds);
scoped_refptr<RasterSource> pending_raster_source =
recording_source->CreateRasterSource(true);
@@ -4389,15 +4403,13 @@ TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) {
host->SetRootLayer(layer);
RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
- int frame_number = 0;
-
client.set_fill_with_nonsolid_color(true);
recording_source->SetNeedsDisplayRect(layer_rect);
Region invalidation1;
- recording_source->UpdateAndExpandInvalidation(
- &client, &invalidation1, layer_bounds, frame_number++,
- RecordingSource::RECORD_NORMALLY);
+
+ GetClientDataAndUpdateInvalidation(recording_source, &client, invalidation1,
+ layer_bounds);
scoped_refptr<RasterSource> raster_source1 =
recording_source->CreateRasterSource(true);
@@ -4415,9 +4427,9 @@ TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) {
recording_source->SetNeedsDisplayRect(layer_rect);
Region invalidation2;
- recording_source->UpdateAndExpandInvalidation(
- &client, &invalidation2, layer_bounds, frame_number++,
- RecordingSource::RECORD_NORMALLY);
+
+ GetClientDataAndUpdateInvalidation(recording_source, &client, invalidation2,
+ layer_bounds);
scoped_refptr<RasterSource> raster_source2 =
recording_source->CreateRasterSource(true);

Powered by Google App Engine
This is Rietveld 408576698