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

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

Issue 1411663002: cc: Split Proxy to eliminate unnecessary dependencies on the impl side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update perf tests. Created 5 years, 2 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 | « cc/tiles/tile_manager_perftest.cc ('k') | cc/trees/damage_tracker_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 "base/run_loop.h" 5 #include "base/run_loop.h"
6 #include "base/thread_task_runner_handle.h" 6 #include "base/thread_task_runner_handle.h"
7 #include "cc/playback/display_list_raster_source.h" 7 #include "cc/playback/display_list_raster_source.h"
8 #include "cc/playback/display_list_recording_source.h" 8 #include "cc/playback/display_list_recording_source.h"
9 #include "cc/raster/raster_buffer.h" 9 #include "cc/raster/raster_buffer.h"
10 #include "cc/resources/resource_pool.h" 10 #include "cc/resources/resource_pool.h"
11 #include "cc/test/begin_frame_args_test.h" 11 #include "cc/test/begin_frame_args_test.h"
12 #include "cc/test/fake_display_list_raster_source.h" 12 #include "cc/test/fake_display_list_raster_source.h"
13 #include "cc/test/fake_display_list_recording_source.h" 13 #include "cc/test/fake_display_list_recording_source.h"
14 #include "cc/test/fake_impl_proxy.h" 14 #include "cc/test/fake_impl_task_runner_provider.h"
15 #include "cc/test/fake_layer_tree_host_impl.h" 15 #include "cc/test/fake_layer_tree_host_impl.h"
16 #include "cc/test/fake_output_surface.h" 16 #include "cc/test/fake_output_surface.h"
17 #include "cc/test/fake_output_surface_client.h" 17 #include "cc/test/fake_output_surface_client.h"
18 #include "cc/test/fake_picture_layer_impl.h" 18 #include "cc/test/fake_picture_layer_impl.h"
19 #include "cc/test/fake_picture_layer_tiling_client.h" 19 #include "cc/test/fake_picture_layer_tiling_client.h"
20 #include "cc/test/fake_tile_manager.h" 20 #include "cc/test/fake_tile_manager.h"
21 #include "cc/test/test_gpu_memory_buffer_manager.h" 21 #include "cc/test/test_gpu_memory_buffer_manager.h"
22 #include "cc/test/test_shared_bitmap_manager.h" 22 #include "cc/test/test_shared_bitmap_manager.h"
23 #include "cc/test/test_task_graph_runner.h" 23 #include "cc/test/test_task_graph_runner.h"
24 #include "cc/test/test_tile_priorities.h" 24 #include "cc/test/test_tile_priorities.h"
(...skipping 18 matching lines...) Expand all
43 } 43 }
44 }; 44 };
45 45
46 class TileManagerTilePriorityQueueTest : public testing::Test { 46 class TileManagerTilePriorityQueueTest : public testing::Test {
47 public: 47 public:
48 TileManagerTilePriorityQueueTest() 48 TileManagerTilePriorityQueueTest()
49 : memory_limit_policy_(ALLOW_ANYTHING), 49 : memory_limit_policy_(ALLOW_ANYTHING),
50 max_tiles_(10000), 50 max_tiles_(10000),
51 ready_to_activate_(false), 51 ready_to_activate_(false),
52 id_(7), 52 id_(7),
53 proxy_(base::ThreadTaskRunnerHandle::Get()), 53 task_runner_provider_(base::ThreadTaskRunnerHandle::Get()),
54 output_surface_(FakeOutputSurface::Create3d()), 54 output_surface_(FakeOutputSurface::Create3d()),
55 host_impl_(LowResTilingsSettings(), 55 host_impl_(LowResTilingsSettings(),
56 &proxy_, 56 &task_runner_provider_,
57 &shared_bitmap_manager_, 57 &shared_bitmap_manager_,
58 &task_graph_runner_, 58 &task_graph_runner_,
59 &gpu_memory_buffer_manager_) {} 59 &gpu_memory_buffer_manager_) {}
60 60
61 void SetTreePriority(TreePriority tree_priority) { 61 void SetTreePriority(TreePriority tree_priority) {
62 GlobalStateThatImpactsTilePriority state; 62 GlobalStateThatImpactsTilePriority state;
63 gfx::Size tile_size(256, 256); 63 gfx::Size tile_size(256, 256);
64 64
65 state.soft_memory_limit_in_bytes = 100 * 1000 * 1000; 65 state.soft_memory_limit_in_bytes = 100 * 1000 * 1000;
66 state.num_resources_limit = max_tiles_; 66 state.num_resources_limit = max_tiles_;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 protected: 156 protected:
157 GlobalStateThatImpactsTilePriority global_state_; 157 GlobalStateThatImpactsTilePriority global_state_;
158 158
159 TestSharedBitmapManager shared_bitmap_manager_; 159 TestSharedBitmapManager shared_bitmap_manager_;
160 TestTaskGraphRunner task_graph_runner_; 160 TestTaskGraphRunner task_graph_runner_;
161 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; 161 TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
162 TileMemoryLimitPolicy memory_limit_policy_; 162 TileMemoryLimitPolicy memory_limit_policy_;
163 int max_tiles_; 163 int max_tiles_;
164 bool ready_to_activate_; 164 bool ready_to_activate_;
165 int id_; 165 int id_;
166 FakeImplProxy proxy_; 166 FakeImplTaskRunnerProvider task_runner_provider_;
167 scoped_ptr<OutputSurface> output_surface_; 167 scoped_ptr<OutputSurface> output_surface_;
168 FakeLayerTreeHostImpl host_impl_; 168 FakeLayerTreeHostImpl host_impl_;
169 FakePictureLayerImpl* pending_layer_; 169 FakePictureLayerImpl* pending_layer_;
170 FakePictureLayerImpl* active_layer_; 170 FakePictureLayerImpl* active_layer_;
171 }; 171 };
172 172
173 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) { 173 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) {
174 const gfx::Size layer_bounds(1000, 1000); 174 const gfx::Size layer_bounds(1000, 1000);
175 host_impl_.SetViewportSize(layer_bounds); 175 host_impl_.SetViewportSize(layer_bounds);
176 SetupDefaultTrees(layer_bounds); 176 SetupDefaultTrees(layer_bounds);
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 1450
1451 class TileManagerTest : public testing::Test { 1451 class TileManagerTest : public testing::Test {
1452 public: 1452 public:
1453 TileManagerTest() 1453 TileManagerTest()
1454 : output_surface_(FakeOutputSurface::CreateSoftware( 1454 : output_surface_(FakeOutputSurface::CreateSoftware(
1455 make_scoped_ptr(new SoftwareOutputDevice))) {} 1455 make_scoped_ptr(new SoftwareOutputDevice))) {}
1456 1456
1457 void SetUp() override { 1457 void SetUp() override {
1458 LayerTreeSettings settings; 1458 LayerTreeSettings settings;
1459 CustomizeSettings(&settings); 1459 CustomizeSettings(&settings);
1460 host_impl_.reset(new MockLayerTreeHostImpl( 1460 host_impl_.reset(new MockLayerTreeHostImpl(settings, &task_runner_provider_,
1461 settings, &proxy_, &shared_bitmap_manager_, &task_graph_runner_)); 1461 &shared_bitmap_manager_,
1462 &task_graph_runner_));
1462 host_impl_->SetVisible(true); 1463 host_impl_->SetVisible(true);
1463 host_impl_->InitializeRenderer(output_surface_.get()); 1464 host_impl_->InitializeRenderer(output_surface_.get());
1464 } 1465 }
1465 1466
1466 protected: 1467 protected:
1467 // MockLayerTreeHostImpl allows us to intercept tile manager callbacks. 1468 // MockLayerTreeHostImpl allows us to intercept tile manager callbacks.
1468 class MockLayerTreeHostImpl : public FakeLayerTreeHostImpl { 1469 class MockLayerTreeHostImpl : public FakeLayerTreeHostImpl {
1469 public: 1470 public:
1470 MockLayerTreeHostImpl(const LayerTreeSettings& settings, 1471 MockLayerTreeHostImpl(const LayerTreeSettings& settings,
1471 Proxy* proxy, 1472 TaskRunnerProvider* task_runner_provider,
1472 SharedBitmapManager* manager, 1473 SharedBitmapManager* manager,
1473 TaskGraphRunner* task_graph_runner) 1474 TaskGraphRunner* task_graph_runner)
1474 : FakeLayerTreeHostImpl(settings, proxy, manager, task_graph_runner) {} 1475 : FakeLayerTreeHostImpl(settings,
1476 task_runner_provider,
1477 manager,
1478 task_graph_runner) {}
1475 1479
1476 MOCK_METHOD0(NotifyAllTileTasksCompleted, void()); 1480 MOCK_METHOD0(NotifyAllTileTasksCompleted, void());
1477 }; 1481 };
1478 1482
1479 // By default do no customization. 1483 // By default do no customization.
1480 virtual void CustomizeSettings(LayerTreeSettings* settings) {} 1484 virtual void CustomizeSettings(LayerTreeSettings* settings) {}
1481 1485
1482 TestSharedBitmapManager shared_bitmap_manager_; 1486 TestSharedBitmapManager shared_bitmap_manager_;
1483 TestTaskGraphRunner task_graph_runner_; 1487 TestTaskGraphRunner task_graph_runner_;
1484 FakeImplProxy proxy_; 1488 FakeImplTaskRunnerProvider task_runner_provider_;
1485 scoped_ptr<OutputSurface> output_surface_; 1489 scoped_ptr<OutputSurface> output_surface_;
1486 scoped_ptr<MockLayerTreeHostImpl> host_impl_; 1490 scoped_ptr<MockLayerTreeHostImpl> host_impl_;
1487 }; 1491 };
1488 1492
1489 // Test to ensure that we call NotifyAllTileTasksCompleted when PrepareTiles is 1493 // Test to ensure that we call NotifyAllTileTasksCompleted when PrepareTiles is
1490 // called. 1494 // called.
1491 TEST_F(TileManagerTest, AllWorkFinishedTest) { 1495 TEST_F(TileManagerTest, AllWorkFinishedTest) {
1492 // Check with no tile work enqueued. 1496 // Check with no tile work enqueued.
1493 { 1497 {
1494 base::RunLoop run_loop; 1498 base::RunLoop run_loop;
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1797 } 1801 }
1798 1802
1799 // Ensures that the tile manager does not attempt to reuse tiles when partial 1803 // Ensures that the tile manager does not attempt to reuse tiles when partial
1800 // raster is disabled. 1804 // raster is disabled.
1801 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { 1805 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) {
1802 RunPartialRasterCheck(host_impl_.Pass(), false /* partial_raster_enabled */); 1806 RunPartialRasterCheck(host_impl_.Pass(), false /* partial_raster_enabled */);
1803 } 1807 }
1804 1808
1805 } // namespace 1809 } // namespace
1806 } // namespace cc 1810 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/tile_manager_perftest.cc ('k') | cc/trees/damage_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698