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

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

Issue 563723004: cc: Make low res tilings off by default in LayerTreeSettings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | cc/resources/tile_manager_unittest.cc » ('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 28 matching lines...) Expand all
39 explicit MockCanvas(int w, int h) : SkCanvas(w, h) {} 39 explicit MockCanvas(int w, int h) : SkCanvas(w, h) {}
40 40
41 virtual void drawRect(const SkRect& rect, const SkPaint& paint) OVERRIDE { 41 virtual void drawRect(const SkRect& rect, const SkPaint& paint) OVERRIDE {
42 // Capture calls before SkCanvas quickReject() kicks in. 42 // Capture calls before SkCanvas quickReject() kicks in.
43 rects_.push_back(rect); 43 rects_.push_back(rect);
44 } 44 }
45 45
46 std::vector<SkRect> rects_; 46 std::vector<SkRect> rects_;
47 }; 47 };
48 48
49 class NoLowResTilingsSettings : public ImplSidePaintingSettings {};
50
51 class LowResTilingsSettings : public ImplSidePaintingSettings {
52 public:
53 LowResTilingsSettings() { create_low_res_tiling = true; }
54 };
55
49 class PictureLayerImplTest : public testing::Test { 56 class PictureLayerImplTest : public testing::Test {
50 public: 57 public:
51 PictureLayerImplTest() 58 PictureLayerImplTest()
52 : proxy_(base::MessageLoopProxy::current()), 59 : proxy_(base::MessageLoopProxy::current()),
53 host_impl_(ImplSidePaintingSettings(), 60 host_impl_(LowResTilingsSettings(), &proxy_, &shared_bitmap_manager_),
54 &proxy_,
55 &shared_bitmap_manager_),
56 id_(7), 61 id_(7),
57 pending_layer_(NULL), 62 pending_layer_(NULL),
58 old_pending_layer_(NULL), 63 old_pending_layer_(NULL),
59 active_layer_(NULL) {} 64 active_layer_(NULL) {}
60 65
61 explicit PictureLayerImplTest(const LayerTreeSettings& settings) 66 explicit PictureLayerImplTest(const LayerTreeSettings& settings)
62 : proxy_(base::MessageLoopProxy::current()), 67 : proxy_(base::MessageLoopProxy::current()),
63 host_impl_(settings, &proxy_, &shared_bitmap_manager_), 68 host_impl_(settings, &proxy_, &shared_bitmap_manager_),
64 id_(7) {} 69 id_(7) {}
65 70
(...skipping 2919 matching lines...) Expand 10 before | Expand all | Expand 10 after
2985 pending_layer_->MarkVisibleResourcesAsRequired(); 2990 pending_layer_->MarkVisibleResourcesAsRequired();
2986 2991
2987 // The unshared high-res tiles are not ready, so we cannot activate. 2992 // The unshared high-res tiles are not ready, so we cannot activate.
2988 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); 2993 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
2989 2994
2990 // When the unshared pending high-res tiles are ready, we can activate. 2995 // When the unshared pending high-res tiles are ready, we can activate.
2991 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling()); 2996 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling());
2992 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); 2997 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
2993 } 2998 }
2994 2999
2995 class NoLowResTilingsSettings : public ImplSidePaintingSettings {
2996 public:
2997 NoLowResTilingsSettings() { create_low_res_tiling = false; }
2998 };
2999
3000 class NoLowResPictureLayerImplTest : public PictureLayerImplTest { 3000 class NoLowResPictureLayerImplTest : public PictureLayerImplTest {
3001 public: 3001 public:
3002 NoLowResPictureLayerImplTest() 3002 NoLowResPictureLayerImplTest()
3003 : PictureLayerImplTest(NoLowResTilingsSettings()) {} 3003 : PictureLayerImplTest(NoLowResTilingsSettings()) {}
3004 }; 3004 };
3005 3005
3006 TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) { 3006 TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) {
3007 gfx::Size tile_size(400, 400); 3007 gfx::Size tile_size(400, 400);
3008 gfx::Size layer_bounds(1300, 1900); 3008 gfx::Size layer_bounds(1300, 1900);
3009 3009
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
3575 3575
3576 // Even when OOM, quads should be produced, and should be different material 3576 // Even when OOM, quads should be produced, and should be different material
3577 // from quads with resource. 3577 // from quads with resource.
3578 EXPECT_LT(max_tiles, render_pass->quad_list.size()); 3578 EXPECT_LT(max_tiles, render_pass->quad_list.size());
3579 EXPECT_EQ(DrawQuad::Material::TILED_CONTENT, 3579 EXPECT_EQ(DrawQuad::Material::TILED_CONTENT,
3580 render_pass->quad_list.front()->material); 3580 render_pass->quad_list.front()->material);
3581 EXPECT_EQ(DrawQuad::Material::SOLID_COLOR, 3581 EXPECT_EQ(DrawQuad::Material::SOLID_COLOR,
3582 render_pass->quad_list.back()->material); 3582 render_pass->quad_list.back()->material);
3583 } 3583 }
3584 3584
3585 class OcclusionTrackingSettings : public ImplSidePaintingSettings { 3585 class OcclusionTrackingSettings : public LowResTilingsSettings {
3586 public: 3586 public:
3587 OcclusionTrackingSettings() { use_occlusion_for_tile_prioritization = true; } 3587 OcclusionTrackingSettings() { use_occlusion_for_tile_prioritization = true; }
3588 }; 3588 };
3589 3589
3590 class OcclusionTrackingPictureLayerImplTest : public PictureLayerImplTest { 3590 class OcclusionTrackingPictureLayerImplTest : public PictureLayerImplTest {
3591 public: 3591 public:
3592 OcclusionTrackingPictureLayerImplTest() 3592 OcclusionTrackingPictureLayerImplTest()
3593 : PictureLayerImplTest(OcclusionTrackingSettings()) {} 3593 : PictureLayerImplTest(OcclusionTrackingSettings()) {}
3594 3594
3595 void VerifyEvictionConsidersOcclusion( 3595 void VerifyEvictionConsidersOcclusion(
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
4217 ActivateTree(); 4217 ActivateTree();
4218 EXPECT_TRUE(active_layer_->GetRecycledTwinLayer()); 4218 EXPECT_TRUE(active_layer_->GetRecycledTwinLayer());
4219 EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer()); 4219 EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer());
4220 4220
4221 host_impl_.ResetRecycleTreeForTesting(); 4221 host_impl_.ResetRecycleTreeForTesting();
4222 EXPECT_FALSE(active_layer_->GetRecycledTwinLayer()); 4222 EXPECT_FALSE(active_layer_->GetRecycledTwinLayer());
4223 } 4223 }
4224 4224
4225 } // namespace 4225 } // namespace
4226 } // namespace cc 4226 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/resources/tile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698