| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| 11 #include "cc/playback/raster_source.h" | 11 #include "cc/playback/raster_source.h" |
| 12 #include "cc/playback/recording_source.h" | 12 #include "cc/playback/recording_source.h" |
| 13 #include "cc/raster/raster_buffer.h" | 13 #include "cc/raster/raster_buffer.h" |
| 14 #include "cc/raster/synchronous_task_graph_runner.h" | 14 #include "cc/raster/synchronous_task_graph_runner.h" |
| 15 #include "cc/resources/resource_pool.h" | 15 #include "cc/resources/resource_pool.h" |
| 16 #include "cc/test/begin_frame_args_test.h" | 16 #include "cc/test/begin_frame_args_test.h" |
| 17 #include "cc/test/fake_compositor_frame_sink.h" | 17 #include "cc/test/fake_compositor_frame_sink.h" |
| 18 #include "cc/test/fake_compositor_frame_sink_client.h" | 18 #include "cc/test/fake_compositor_frame_sink_client.h" |
| 19 #include "cc/test/fake_impl_task_runner_provider.h" | 19 #include "cc/test/fake_impl_task_runner_provider.h" |
| 20 #include "cc/test/fake_layer_tree_host_impl.h" | 20 #include "cc/test/fake_layer_tree_host_impl.h" |
| 21 #include "cc/test/fake_picture_layer_impl.h" | 21 #include "cc/test/fake_picture_layer_impl.h" |
| 22 #include "cc/test/fake_picture_layer_tiling_client.h" | 22 #include "cc/test/fake_picture_layer_tiling_client.h" |
| 23 #include "cc/test/fake_raster_source.h" | 23 #include "cc/test/fake_raster_source.h" |
| 24 #include "cc/test/fake_recording_source.h" | 24 #include "cc/test/fake_recording_source.h" |
| 25 #include "cc/test/fake_tile_manager.h" | 25 #include "cc/test/fake_tile_manager.h" |
| 26 #include "cc/test/fake_tile_task_manager.h" | 26 #include "cc/test/fake_tile_task_manager.h" |
| 27 #include "cc/test/layer_tree_settings_for_testing.h" | 27 #include "cc/test/layer_tree_settings_for_testing.h" |
| 28 #include "cc/test/test_gpu_memory_buffer_manager.h" | |
| 29 #include "cc/test/test_layer_tree_host_base.h" | 28 #include "cc/test/test_layer_tree_host_base.h" |
| 30 #include "cc/test/test_shared_bitmap_manager.h" | |
| 31 #include "cc/test/test_task_graph_runner.h" | 29 #include "cc/test/test_task_graph_runner.h" |
| 32 #include "cc/test/test_tile_priorities.h" | 30 #include "cc/test/test_tile_priorities.h" |
| 33 #include "cc/tiles/eviction_tile_priority_queue.h" | 31 #include "cc/tiles/eviction_tile_priority_queue.h" |
| 34 #include "cc/tiles/raster_tile_priority_queue.h" | 32 #include "cc/tiles/raster_tile_priority_queue.h" |
| 35 #include "cc/tiles/tile.h" | 33 #include "cc/tiles/tile.h" |
| 36 #include "cc/tiles/tile_priority.h" | 34 #include "cc/tiles/tile_priority.h" |
| 37 #include "cc/tiles/tiling_set_raster_queue_all.h" | 35 #include "cc/tiles/tiling_set_raster_queue_all.h" |
| 38 #include "cc/trees/layer_tree_impl.h" | 36 #include "cc/trees/layer_tree_impl.h" |
| 39 #include "testing/gmock/include/gmock/gmock.h" | 37 #include "testing/gmock/include/gmock/gmock.h" |
| 40 #include "testing/gtest/include/gtest/gtest.h" | 38 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 EXPECT_EQ(solid_color, tile->draw_info().solid_color()); | 1466 EXPECT_EQ(solid_color, tile->draw_info().solid_color()); |
| 1469 } | 1467 } |
| 1470 } | 1468 } |
| 1471 } | 1469 } |
| 1472 | 1470 |
| 1473 class TileManagerTest : public TestLayerTreeHostBase { | 1471 class TileManagerTest : public TestLayerTreeHostBase { |
| 1474 public: | 1472 public: |
| 1475 // MockLayerTreeHostImpl allows us to intercept tile manager callbacks. | 1473 // MockLayerTreeHostImpl allows us to intercept tile manager callbacks. |
| 1476 class MockLayerTreeHostImpl : public FakeLayerTreeHostImpl { | 1474 class MockLayerTreeHostImpl : public FakeLayerTreeHostImpl { |
| 1477 public: | 1475 public: |
| 1478 MockLayerTreeHostImpl( | 1476 MockLayerTreeHostImpl(const LayerTreeSettings& settings, |
| 1479 const LayerTreeSettings& settings, | 1477 TaskRunnerProvider* task_runner_provider, |
| 1480 TaskRunnerProvider* task_runner_provider, | 1478 TaskGraphRunner* task_graph_runner) |
| 1481 SharedBitmapManager* manager, | |
| 1482 TaskGraphRunner* task_graph_runner, | |
| 1483 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) | |
| 1484 : FakeLayerTreeHostImpl(settings, | 1479 : FakeLayerTreeHostImpl(settings, |
| 1485 task_runner_provider, | 1480 task_runner_provider, |
| 1486 manager, | 1481 task_graph_runner) {} |
| 1487 task_graph_runner, | |
| 1488 gpu_memory_buffer_manager) {} | |
| 1489 | 1482 |
| 1490 MOCK_METHOD0(NotifyAllTileTasksCompleted, void()); | 1483 MOCK_METHOD0(NotifyAllTileTasksCompleted, void()); |
| 1491 MOCK_METHOD0(NotifyReadyToDraw, void()); | 1484 MOCK_METHOD0(NotifyReadyToDraw, void()); |
| 1492 }; | 1485 }; |
| 1493 | 1486 |
| 1494 std::unique_ptr<FakeLayerTreeHostImpl> CreateHostImpl( | 1487 std::unique_ptr<FakeLayerTreeHostImpl> CreateHostImpl( |
| 1495 const LayerTreeSettings& settings, | 1488 const LayerTreeSettings& settings, |
| 1496 TaskRunnerProvider* task_runner_provider, | 1489 TaskRunnerProvider* task_runner_provider, |
| 1497 SharedBitmapManager* shared_bitmap_manager, | 1490 TaskGraphRunner* task_graph_runner) override { |
| 1498 TaskGraphRunner* task_graph_runner, | |
| 1499 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) override { | |
| 1500 return base::MakeUnique<MockLayerTreeHostImpl>( | 1491 return base::MakeUnique<MockLayerTreeHostImpl>( |
| 1501 settings, task_runner_provider, shared_bitmap_manager, | 1492 settings, task_runner_provider, task_graph_runner); |
| 1502 task_graph_runner, gpu_memory_buffer_manager); | |
| 1503 } | 1493 } |
| 1504 | 1494 |
| 1505 // By default use software compositing (no context provider). | 1495 // By default use software compositing (no context provider). |
| 1506 std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink() override { | 1496 std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink() override { |
| 1507 return FakeCompositorFrameSink::CreateSoftware(); | 1497 return FakeCompositorFrameSink::CreateSoftware(); |
| 1508 } | 1498 } |
| 1509 | 1499 |
| 1510 MockLayerTreeHostImpl& MockHostImpl() { | 1500 MockLayerTreeHostImpl& MockHostImpl() { |
| 1511 return *static_cast<MockLayerTreeHostImpl*>(host_impl()); | 1501 return *static_cast<MockLayerTreeHostImpl*>(host_impl()); |
| 1512 } | 1502 } |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1889 } | 1879 } |
| 1890 | 1880 |
| 1891 // Ensures that the tile manager does not attempt to reuse tiles when partial | 1881 // Ensures that the tile manager does not attempt to reuse tiles when partial |
| 1892 // raster is disabled. | 1882 // raster is disabled. |
| 1893 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { | 1883 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { |
| 1894 RunPartialRasterCheck(TakeHostImpl(), false /* partial_raster_enabled */); | 1884 RunPartialRasterCheck(TakeHostImpl(), false /* partial_raster_enabled */); |
| 1895 } | 1885 } |
| 1896 | 1886 |
| 1897 } // namespace | 1887 } // namespace |
| 1898 } // namespace cc | 1888 } // namespace cc |
| OLD | NEW |