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

Side by Side Diff: trunk/src/cc/layers/picture_layer_impl_unittest.cc

Issue 473813002: Revert 289480 "Still produce quad when tile OOM and on demand ra..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/src/cc/layers/picture_layer_impl.cc ('k') | trunk/src/cc/resources/tile_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 3083 matching lines...) Expand 10 before | Expand all | Expand 10 after
3094 3094
3095 root->AddChild(layer_with_mask.PassAs<LayerImpl>()); 3095 root->AddChild(layer_with_mask.PassAs<LayerImpl>());
3096 3096
3097 host_impl_.pending_tree()->SetRootLayer(root.Pass()); 3097 host_impl_.pending_tree()->SetRootLayer(root.Pass());
3098 3098
3099 EXPECT_FALSE(pending_mask_content->tilings()); 3099 EXPECT_FALSE(pending_mask_content->tilings());
3100 host_impl_.pending_tree()->UpdateDrawProperties(); 3100 host_impl_.pending_tree()->UpdateDrawProperties();
3101 EXPECT_NE(0u, pending_mask_content->num_tilings()); 3101 EXPECT_NE(0u, pending_mask_content->num_tilings());
3102 } 3102 }
3103 3103
3104 class PictureLayerImplTestWithDelegatingRenderer : public PictureLayerImplTest {
3105 public:
3106 PictureLayerImplTestWithDelegatingRenderer() : PictureLayerImplTest() {}
3107
3108 virtual void InitializeRenderer() OVERRIDE {
3109 host_impl_.InitializeRenderer(
3110 FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>());
3111 }
3112 };
3113
3114 TEST_F(PictureLayerImplTestWithDelegatingRenderer,
3115 DelegatingRendererWithTileOOM) {
3116 // This test is added for crbug.com/402321, where quad should be produced when
3117 // raster on demand is not allowed and tile is OOM.
3118 gfx::Size tile_size = host_impl_.settings().default_tile_size;
3119 gfx::Size layer_bounds(1000, 1000);
3120
3121 // Create tiles.
3122 scoped_refptr<FakePicturePileImpl> pending_pile =
3123 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
3124 SetupPendingTree(pending_pile);
3125 pending_layer_->SetBounds(layer_bounds);
3126 host_impl_.SetViewportSize(layer_bounds);
3127 ActivateTree();
3128 host_impl_.active_tree()->UpdateDrawProperties();
3129 std::vector<Tile*> tiles =
3130 active_layer_->HighResTiling()->AllTilesForTesting();
3131 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles);
3132
3133 // Force tiles after max_tiles to be OOM. TileManager uses
3134 // GlobalStateThatImpactsTilesPriority from LayerTreeHostImpl, and we cannot
3135 // directly set state to host_impl_, so we set policy that would change the
3136 // state. We also need to update tree priority separately.
3137 GlobalStateThatImpactsTilePriority state;
3138 size_t max_tiles = 1;
3139 size_t memory_limit = max_tiles * 4 * tile_size.width() * tile_size.height();
3140 size_t resource_limit = max_tiles;
3141 ManagedMemoryPolicy policy(memory_limit,
3142 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING,
3143 resource_limit);
3144 host_impl_.SetMemoryPolicy(policy);
3145 host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES);
3146 host_impl_.ManageTiles();
3147
3148 MockOcclusionTracker<LayerImpl> occlusion_tracker;
3149 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
3150 AppendQuadsData data;
3151 active_layer_->WillDraw(DRAW_MODE_HARDWARE, NULL);
3152 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data);
3153 active_layer_->DidDraw(NULL);
3154
3155 // Even when OOM, quads should be produced, and should be different material
3156 // from quads with resource.
3157 EXPECT_LT(max_tiles, render_pass->quad_list.size());
3158 EXPECT_EQ(DrawQuad::Material::TILED_CONTENT,
3159 render_pass->quad_list.front()->material);
3160 EXPECT_EQ(DrawQuad::Material::SOLID_COLOR,
3161 render_pass->quad_list.back()->material);
3162 }
3163
3164 class OcclusionTrackingSettings : public ImplSidePaintingSettings { 3104 class OcclusionTrackingSettings : public ImplSidePaintingSettings {
3165 public: 3105 public:
3166 OcclusionTrackingSettings() { use_occlusion_for_tile_prioritization = true; } 3106 OcclusionTrackingSettings() { use_occlusion_for_tile_prioritization = true; }
3167 }; 3107 };
3168 3108
3169 class OcclusionTrackingPictureLayerImplTest : public PictureLayerImplTest { 3109 class OcclusionTrackingPictureLayerImplTest : public PictureLayerImplTest {
3170 public: 3110 public:
3171 OcclusionTrackingPictureLayerImplTest() 3111 OcclusionTrackingPictureLayerImplTest()
3172 : PictureLayerImplTest(OcclusionTrackingSettings()) {} 3112 : PictureLayerImplTest(OcclusionTrackingSettings()) {}
3173 3113
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
3764 3704
3765 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); 3705 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles);
3766 3706
3767 VerifyEvictionConsidersOcclusion(pending_layer_, 3707 VerifyEvictionConsidersOcclusion(pending_layer_,
3768 total_expected_occluded_tile_count); 3708 total_expected_occluded_tile_count);
3769 VerifyEvictionConsidersOcclusion(active_layer_, 3709 VerifyEvictionConsidersOcclusion(active_layer_,
3770 total_expected_occluded_tile_count); 3710 total_expected_occluded_tile_count);
3771 } 3711 }
3772 } // namespace 3712 } // namespace
3773 } // namespace cc 3713 } // namespace cc
OLDNEW
« no previous file with comments | « trunk/src/cc/layers/picture_layer_impl.cc ('k') | trunk/src/cc/resources/tile_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698