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

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: Remove ContentLayerClient* painter from UpdateAndExpandInvalidation and sync to head Created 4 years, 4 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/layers/picture_layer.cc ('k') | cc/layers/picture_layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d6496371043d169f92a9ba25dfcde1d0e94743b3..3e0d73492cce2d446122f55832524d463f0800e7 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -4309,6 +4309,23 @@ 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(&invalidation, layer_bounds,
+ new_recorded_viewport);
+ recording_source->UpdateDisplayItemList(display_list,
+ painter_reported_memory_usage);
+}
+
void PictureLayerImplTest::TestQuadsForSolidColor(bool test_for_solid) {
host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
@@ -4326,14 +4343,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 +4404,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 +4428,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);
« no previous file with comments | « cc/layers/picture_layer.cc ('k') | cc/layers/picture_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698