OLD | NEW |
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" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 state.num_resources_limit); | 71 state.num_resources_limit); |
72 host_impl_.tile_manager()->SetGlobalStateForTesting(state); | 72 host_impl_.tile_manager()->SetGlobalStateForTesting(state); |
73 } | 73 } |
74 | 74 |
75 void SetUp() override { | 75 void SetUp() override { |
76 InitializeRenderer(); | 76 InitializeRenderer(); |
77 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); | 77 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); |
78 } | 78 } |
79 | 79 |
80 virtual void InitializeRenderer() { | 80 virtual void InitializeRenderer() { |
| 81 host_impl_.SetVisible(true); |
81 host_impl_.InitializeRenderer(output_surface_.get()); | 82 host_impl_.InitializeRenderer(output_surface_.get()); |
82 } | 83 } |
83 | 84 |
84 void SetupDefaultTrees(const gfx::Size& layer_bounds) { | 85 void SetupDefaultTrees(const gfx::Size& layer_bounds) { |
85 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source = | 86 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source = |
86 FakeDisplayListRasterSource::CreateFilled(layer_bounds); | 87 FakeDisplayListRasterSource::CreateFilled(layer_bounds); |
87 scoped_refptr<FakeDisplayListRasterSource> active_raster_source = | 88 scoped_refptr<FakeDisplayListRasterSource> active_raster_source = |
88 FakeDisplayListRasterSource::CreateFilled(layer_bounds); | 89 FakeDisplayListRasterSource::CreateFilled(layer_bounds); |
89 | 90 |
90 SetupTrees(pending_raster_source, active_raster_source); | 91 SetupTrees(pending_raster_source, active_raster_source); |
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 } | 1439 } |
1439 | 1440 |
1440 class TileManagerTest : public testing::Test { | 1441 class TileManagerTest : public testing::Test { |
1441 public: | 1442 public: |
1442 TileManagerTest() | 1443 TileManagerTest() |
1443 : output_surface_(FakeOutputSurface::CreateSoftware( | 1444 : output_surface_(FakeOutputSurface::CreateSoftware( |
1444 make_scoped_ptr(new SoftwareOutputDevice))), | 1445 make_scoped_ptr(new SoftwareOutputDevice))), |
1445 host_impl_(new MockLayerTreeHostImpl(&proxy_, | 1446 host_impl_(new MockLayerTreeHostImpl(&proxy_, |
1446 &shared_bitmap_manager_, | 1447 &shared_bitmap_manager_, |
1447 &task_graph_runner_)) { | 1448 &task_graph_runner_)) { |
| 1449 host_impl_->SetVisible(true); |
1448 host_impl_->InitializeRenderer(output_surface_.get()); | 1450 host_impl_->InitializeRenderer(output_surface_.get()); |
1449 } | 1451 } |
1450 | 1452 |
1451 protected: | 1453 protected: |
1452 // MockLayerTreeHostImpl allows us to intercept tile manager callbacks. | 1454 // MockLayerTreeHostImpl allows us to intercept tile manager callbacks. |
1453 class MockLayerTreeHostImpl : public FakeLayerTreeHostImpl { | 1455 class MockLayerTreeHostImpl : public FakeLayerTreeHostImpl { |
1454 public: | 1456 public: |
1455 MockLayerTreeHostImpl(Proxy* proxy, | 1457 MockLayerTreeHostImpl(Proxy* proxy, |
1456 SharedBitmapManager* manager, | 1458 SharedBitmapManager* manager, |
1457 TaskGraphRunner* task_graph_runner) | 1459 TaskGraphRunner* task_graph_runner) |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1664 EXPECT_FALSE(host_impl_->resource_pool()->TryAcquireResourceWithContentId( | 1666 EXPECT_FALSE(host_impl_->resource_pool()->TryAcquireResourceWithContentId( |
1665 invalidated_id)); | 1667 invalidated_id)); |
1666 | 1668 |
1667 // Free our host_impl_ before the cancelling_runner we passed it, as it will | 1669 // Free our host_impl_ before the cancelling_runner we passed it, as it will |
1668 // use that class in clean up. | 1670 // use that class in clean up. |
1669 host_impl_ = nullptr; | 1671 host_impl_ = nullptr; |
1670 } | 1672 } |
1671 | 1673 |
1672 } // namespace | 1674 } // namespace |
1673 } // namespace cc | 1675 } // namespace cc |
OLD | NEW |