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 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1723 // Fake TileTaskRunner that just cancels all scheduled tasks immediately. | 1723 // Fake TileTaskRunner that just cancels all scheduled tasks immediately. |
1724 class CancellingTileTaskRunner : public FakeTileTaskRunner { | 1724 class CancellingTileTaskRunner : public FakeTileTaskRunner { |
1725 public: | 1725 public: |
1726 CancellingTileTaskRunner() {} | 1726 CancellingTileTaskRunner() {} |
1727 ~CancellingTileTaskRunner() override {} | 1727 ~CancellingTileTaskRunner() override {} |
1728 | 1728 |
1729 void ScheduleTasks(TaskGraph* graph) override { | 1729 void ScheduleTasks(TaskGraph* graph) override { |
1730 // Just call CompleteOnOriginThread on each item in the queue. As none of | 1730 // Just call CompleteOnOriginThread on each item in the queue. As none of |
1731 // these items have run yet, they will be treated as cancelled tasks. | 1731 // these items have run yet, they will be treated as cancelled tasks. |
1732 for (const auto& node : graph->nodes) { | 1732 for (const auto& node : graph->nodes) { |
1733 static_cast<RasterTask*>(node.task)->CompleteOnOriginThread(this); | 1733 static_cast<TileTask*>(node.task)->CompleteOnOriginThread(this); |
1734 } | 1734 } |
1735 } | 1735 } |
1736 }; | 1736 }; |
1737 | 1737 |
1738 class PartialRasterTileManagerTest : public TileManagerTest { | 1738 class PartialRasterTileManagerTest : public TileManagerTest { |
1739 public: | 1739 public: |
1740 void CustomizeSettings(LayerTreeSettingsForTesting* settings) override { | 1740 void CustomizeSettings(LayerTreeSettingsForTesting* settings) override { |
1741 settings->use_partial_raster = true; | 1741 settings->use_partial_raster = true; |
1742 } | 1742 } |
1743 }; | 1743 }; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1798 | 1798 |
1799 // Fake TileTaskRunner that verifies the resource content ID of raster tasks. | 1799 // Fake TileTaskRunner that verifies the resource content ID of raster tasks. |
1800 class VerifyResourceContentIdTileTaskRunner : public FakeTileTaskRunner { | 1800 class VerifyResourceContentIdTileTaskRunner : public FakeTileTaskRunner { |
1801 public: | 1801 public: |
1802 explicit VerifyResourceContentIdTileTaskRunner(uint64_t expected_resource_id) | 1802 explicit VerifyResourceContentIdTileTaskRunner(uint64_t expected_resource_id) |
1803 : expected_resource_id_(expected_resource_id) {} | 1803 : expected_resource_id_(expected_resource_id) {} |
1804 ~VerifyResourceContentIdTileTaskRunner() override {} | 1804 ~VerifyResourceContentIdTileTaskRunner() override {} |
1805 | 1805 |
1806 void ScheduleTasks(TaskGraph* graph) override { | 1806 void ScheduleTasks(TaskGraph* graph) override { |
1807 for (const auto& node : graph->nodes) { | 1807 for (const auto& node : graph->nodes) { |
1808 RasterTask* task = static_cast<RasterTask*>(node.task); | 1808 TileTask* task = static_cast<TileTask*>(node.task); |
1809 // Triggers a call to AcquireBufferForRaster. | 1809 // Triggers a call to AcquireBufferForRaster. |
1810 task->ScheduleOnOriginThread(this); | 1810 task->ScheduleOnOriginThread(this); |
1811 // Calls TileManager as though task was cancelled. | 1811 // Calls TileManager as though task was cancelled. |
1812 task->CompleteOnOriginThread(this); | 1812 task->CompleteOnOriginThread(this); |
1813 } | 1813 } |
1814 } | 1814 } |
1815 | 1815 |
1816 // TileTaskClient methods. | 1816 // TileTaskClient methods. |
1817 scoped_ptr<RasterBuffer> AcquireBufferForRaster( | 1817 scoped_ptr<RasterBuffer> AcquireBufferForRaster( |
1818 const Resource* resource, | 1818 const Resource* resource, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1893 | 1893 |
1894 // Ensures that the tile manager does not attempt to reuse tiles when partial | 1894 // Ensures that the tile manager does not attempt to reuse tiles when partial |
1895 // raster is disabled. | 1895 // raster is disabled. |
1896 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { | 1896 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { |
1897 RunPartialRasterCheck(std::move(host_impl_), | 1897 RunPartialRasterCheck(std::move(host_impl_), |
1898 false /* partial_raster_enabled */); | 1898 false /* partial_raster_enabled */); |
1899 } | 1899 } |
1900 | 1900 |
1901 } // namespace | 1901 } // namespace |
1902 } // namespace cc | 1902 } // namespace cc |
OLD | NEW |