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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 468983002: Still produce quad when tile OOM and on demand raster is not allowed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 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_impl.cc ('k') | cc/resources/prioritized_tile_set.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 4da402a59ea9d8c312f1bc92fe7170745d785263..f9819313d3db7947172acd175f33eced7ba53e63 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -3111,6 +3111,66 @@ TEST_F(PictureLayerImplTest, UpdateTilesForMasksWithNoVisibleContent) {
EXPECT_NE(0u, pending_mask_content->num_tilings());
}
+class PictureLayerImplTestWithDelegatingRenderer : public PictureLayerImplTest {
+ public:
+ PictureLayerImplTestWithDelegatingRenderer() : PictureLayerImplTest() {}
+
+ virtual void InitializeRenderer() OVERRIDE {
+ host_impl_.InitializeRenderer(
+ FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>());
+ }
+};
+
+TEST_F(PictureLayerImplTestWithDelegatingRenderer,
+ DelegatingRendererWithTileOOM) {
+ // This test is added for crbug.com/402321, where quad should be produced when
+ // raster on demand is not allowed and tile is OOM.
+ gfx::Size tile_size = host_impl_.settings().default_tile_size;
+ gfx::Size layer_bounds(1000, 1000);
+
+ // Create tiles.
+ scoped_refptr<FakePicturePileImpl> pending_pile =
+ FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
+ SetupPendingTree(pending_pile);
+ pending_layer_->SetBounds(layer_bounds);
+ host_impl_.SetViewportSize(layer_bounds);
+ ActivateTree();
+ host_impl_.active_tree()->UpdateDrawProperties();
+ std::vector<Tile*> tiles =
+ active_layer_->HighResTiling()->AllTilesForTesting();
+ host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles);
+
+ // Force tiles after max_tiles to be OOM. TileManager uses
+ // GlobalStateThatImpactsTilesPriority from LayerTreeHostImpl, and we cannot
+ // directly set state to host_impl_, so we set policy that would change the
+ // state. We also need to update tree priority separately.
+ GlobalStateThatImpactsTilePriority state;
+ size_t max_tiles = 1;
+ size_t memory_limit = max_tiles * 4 * tile_size.width() * tile_size.height();
+ size_t resource_limit = max_tiles;
+ ManagedMemoryPolicy policy(memory_limit,
+ gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING,
+ resource_limit);
+ host_impl_.SetMemoryPolicy(policy);
+ host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES);
+ host_impl_.ManageTiles();
+
+ MockOcclusionTracker<LayerImpl> occlusion_tracker;
+ scoped_ptr<RenderPass> render_pass = RenderPass::Create();
+ AppendQuadsData data;
+ active_layer_->WillDraw(DRAW_MODE_HARDWARE, NULL);
+ active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data);
+ active_layer_->DidDraw(NULL);
+
+ // Even when OOM, quads should be produced, and should be different material
+ // from quads with resource.
+ EXPECT_LT(max_tiles, render_pass->quad_list.size());
+ EXPECT_EQ(DrawQuad::Material::TILED_CONTENT,
+ render_pass->quad_list.front()->material);
+ EXPECT_EQ(DrawQuad::Material::SOLID_COLOR,
+ render_pass->quad_list.back()->material);
+}
+
class OcclusionTrackingSettings : public ImplSidePaintingSettings {
public:
OcclusionTrackingSettings() { use_occlusion_for_tile_prioritization = true; }
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/resources/prioritized_tile_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698