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

Side by Side Diff: cc/tiles/tile_manager_unittest.cc

Issue 1800923002: cc: Directly use property trees to calculate clip rect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add setting to only calculate and verify in cc_unittest Created 4 years, 9 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
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "cc/playback/display_list_raster_source.h" 10 #include "cc/playback/display_list_raster_source.h"
(...skipping 24 matching lines...) Expand all
35 #include "testing/gtest/include/gtest/gtest.h" 35 #include "testing/gtest/include/gtest/gtest.h"
36 #include "third_party/skia/include/core/SkSurface.h" 36 #include "third_party/skia/include/core/SkSurface.h"
37 37
38 namespace cc { 38 namespace cc {
39 namespace { 39 namespace {
40 40
41 class LowResTilingsSettings : public LayerTreeSettings { 41 class LowResTilingsSettings : public LayerTreeSettings {
42 public: 42 public:
43 LowResTilingsSettings() { 43 LowResTilingsSettings() {
44 create_low_res_tiling = true; 44 create_low_res_tiling = true;
45 verify_clip_tree_calculations = true;
45 } 46 }
46 }; 47 };
47 48
48 class TileManagerTilePriorityQueueTest : public testing::Test { 49 class TileManagerTilePriorityQueueTest : public testing::Test {
49 public: 50 public:
50 TileManagerTilePriorityQueueTest() 51 TileManagerTilePriorityQueueTest()
51 : memory_limit_policy_(ALLOW_ANYTHING), 52 : memory_limit_policy_(ALLOW_ANYTHING),
52 max_tiles_(10000), 53 max_tiles_(10000),
53 ready_to_activate_(false), 54 ready_to_activate_(false),
54 id_(7), 55 id_(7),
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 1195
1195 gfx::Rect viewport(50, 50, 500, 500); 1196 gfx::Rect viewport(50, 50, 500, 500);
1196 gfx::Size layer_bounds(1600, 1600); 1197 gfx::Size layer_bounds(1600, 1600);
1197 1198
1198 float inset = PictureLayerTiling::CalculateSoonBorderDistance(viewport, 1.0f); 1199 float inset = PictureLayerTiling::CalculateSoonBorderDistance(viewport, 1.0f);
1199 gfx::Rect soon_rect = viewport; 1200 gfx::Rect soon_rect = viewport;
1200 soon_rect.Inset(-inset, -inset); 1201 soon_rect.Inset(-inset, -inset);
1201 1202
1202 client.SetTileSize(gfx::Size(30, 30)); 1203 client.SetTileSize(gfx::Size(30, 30));
1203 LayerTreeSettings settings; 1204 LayerTreeSettings settings;
1205 settings.verify_clip_tree_calculations = true;
1204 1206
1205 scoped_ptr<PictureLayerTilingSet> tiling_set = PictureLayerTilingSet::Create( 1207 scoped_ptr<PictureLayerTilingSet> tiling_set = PictureLayerTilingSet::Create(
1206 ACTIVE_TREE, &client, settings.tiling_interest_area_padding, 1208 ACTIVE_TREE, &client, settings.tiling_interest_area_padding,
1207 settings.skewport_target_time_in_seconds, 1209 settings.skewport_target_time_in_seconds,
1208 settings.skewport_extrapolation_limit_in_content_pixels); 1210 settings.skewport_extrapolation_limit_in_content_pixels);
1209 1211
1210 scoped_refptr<FakeDisplayListRasterSource> raster_source = 1212 scoped_refptr<FakeDisplayListRasterSource> raster_source =
1211 FakeDisplayListRasterSource::CreateFilled(layer_bounds); 1213 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
1212 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); 1214 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source);
1213 tiling->set_resolution(HIGH_RESOLUTION); 1215 tiling->set_resolution(HIGH_RESOLUTION);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 TEST_F(TileManagerTilePriorityQueueTest, 1305 TEST_F(TileManagerTilePriorityQueueTest,
1304 RasterTilePriorityQueueMovingViewport) { 1306 RasterTilePriorityQueueMovingViewport) {
1305 FakePictureLayerTilingClient client; 1307 FakePictureLayerTilingClient client;
1306 1308
1307 gfx::Rect viewport(50, 0, 100, 100); 1309 gfx::Rect viewport(50, 0, 100, 100);
1308 gfx::Rect moved_viewport(50, 0, 100, 500); 1310 gfx::Rect moved_viewport(50, 0, 100, 500);
1309 gfx::Size layer_bounds(1000, 1000); 1311 gfx::Size layer_bounds(1000, 1000);
1310 1312
1311 client.SetTileSize(gfx::Size(30, 30)); 1313 client.SetTileSize(gfx::Size(30, 30));
1312 LayerTreeSettings settings; 1314 LayerTreeSettings settings;
1315 settings.verify_clip_tree_calculations = true;
1313 1316
1314 scoped_ptr<PictureLayerTilingSet> tiling_set = PictureLayerTilingSet::Create( 1317 scoped_ptr<PictureLayerTilingSet> tiling_set = PictureLayerTilingSet::Create(
1315 ACTIVE_TREE, &client, settings.tiling_interest_area_padding, 1318 ACTIVE_TREE, &client, settings.tiling_interest_area_padding,
1316 settings.skewport_target_time_in_seconds, 1319 settings.skewport_target_time_in_seconds,
1317 settings.skewport_extrapolation_limit_in_content_pixels); 1320 settings.skewport_extrapolation_limit_in_content_pixels);
1318 1321
1319 scoped_refptr<FakeDisplayListRasterSource> raster_source = 1322 scoped_refptr<FakeDisplayListRasterSource> raster_source =
1320 FakeDisplayListRasterSource::CreateFilled(layer_bounds); 1323 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
1321 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); 1324 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source);
1322 tiling->set_resolution(HIGH_RESOLUTION); 1325 tiling->set_resolution(HIGH_RESOLUTION);
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 1581
1579 // TODO(vmpstr): Merge TileManagerTest and TileManagerTilePriorityQueueTest. 1582 // TODO(vmpstr): Merge TileManagerTest and TileManagerTilePriorityQueueTest.
1580 class TileManagerTest : public testing::Test { 1583 class TileManagerTest : public testing::Test {
1581 public: 1584 public:
1582 TileManagerTest() 1585 TileManagerTest()
1583 : output_surface_(FakeOutputSurface::CreateSoftware( 1586 : output_surface_(FakeOutputSurface::CreateSoftware(
1584 make_scoped_ptr(new SoftwareOutputDevice))) {} 1587 make_scoped_ptr(new SoftwareOutputDevice))) {}
1585 1588
1586 void SetUp() override { 1589 void SetUp() override {
1587 LayerTreeSettings settings; 1590 LayerTreeSettings settings;
1591 settings.verify_clip_tree_calculations = true;
1592
1588 CustomizeSettings(&settings); 1593 CustomizeSettings(&settings);
1589 host_impl_.reset(new MockLayerTreeHostImpl(settings, &task_runner_provider_, 1594 host_impl_.reset(new MockLayerTreeHostImpl(settings, &task_runner_provider_,
1590 &shared_bitmap_manager_, 1595 &shared_bitmap_manager_,
1591 &task_graph_runner_)); 1596 &task_graph_runner_));
1592 host_impl_->SetVisible(true); 1597 host_impl_->SetVisible(true);
1593 host_impl_->InitializeRenderer(output_surface_.get()); 1598 host_impl_->InitializeRenderer(output_surface_.get());
1594 } 1599 }
1595 1600
1596 void SetupDefaultTrees(const gfx::Size& layer_bounds) { 1601 void SetupDefaultTrees(const gfx::Size& layer_bounds) {
1597 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source = 1602 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 2025
2021 // Ensures that the tile manager does not attempt to reuse tiles when partial 2026 // Ensures that the tile manager does not attempt to reuse tiles when partial
2022 // raster is disabled. 2027 // raster is disabled.
2023 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { 2028 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) {
2024 RunPartialRasterCheck(std::move(host_impl_), 2029 RunPartialRasterCheck(std::move(host_impl_),
2025 false /* partial_raster_enabled */); 2030 false /* partial_raster_enabled */);
2026 } 2031 }
2027 2032
2028 } // namespace 2033 } // namespace
2029 } // namespace cc 2034 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698