| 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/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1821 // Since it's high res, the bitmap (blue) was drawn, and the | 1821 // Since it's high res, the bitmap (blue) was drawn, and the |
| 1822 // background is not visible. | 1822 // background is not visible. |
| 1823 ASSERT_EQ(SK_ColorBLUE, bitmap->getColor(x, y)); | 1823 ASSERT_EQ(SK_ColorBLUE, bitmap->getColor(x, y)); |
| 1824 } | 1824 } |
| 1825 } | 1825 } |
| 1826 } | 1826 } |
| 1827 } | 1827 } |
| 1828 } | 1828 } |
| 1829 | 1829 |
| 1830 // Fake TileTaskRunner that just no-ops all calls. | 1830 // Fake TileTaskRunner that just no-ops all calls. |
| 1831 class FakeTileTaskRunner : public TileTaskRunner, public TileTaskClient { | 1831 class FakeTileTaskRunner : public TileTaskRunner, public RasterBufferProvider { |
| 1832 public: | 1832 public: |
| 1833 FakeTileTaskRunner() {} | 1833 FakeTileTaskRunner() {} |
| 1834 ~FakeTileTaskRunner() override {} | 1834 ~FakeTileTaskRunner() override {} |
| 1835 | 1835 |
| 1836 // TileTaskRunner methods. | 1836 // TileTaskRunner methods. |
| 1837 void Shutdown() override {} | 1837 void Shutdown() override {} |
| 1838 void CheckForCompletedTasks() override {} | 1838 void CheckForCompletedTasks() override {} |
| 1839 ResourceFormat GetResourceFormat(bool must_support_alpha) const override { | 1839 ResourceFormat GetResourceFormat(bool must_support_alpha) const override { |
| 1840 return ResourceFormat::RGBA_8888; | 1840 return ResourceFormat::RGBA_8888; |
| 1841 } | 1841 } |
| 1842 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override { | 1842 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override { |
| 1843 return false; | 1843 return false; |
| 1844 } | 1844 } |
| 1845 RasterBufferProvider* AsRasterBufferProvider() override { return this; } |
| 1845 | 1846 |
| 1846 void ScheduleTasks(TaskGraph* graph) override {} | 1847 void ScheduleTasks(TaskGraph* graph) override {} |
| 1847 | 1848 |
| 1848 // TileTaskClient methods. | 1849 // RasterBufferProvider methods. |
| 1849 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( | 1850 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( |
| 1850 const Resource* resource, | 1851 const Resource* resource, |
| 1851 uint64_t resource_content_id, | 1852 uint64_t resource_content_id, |
| 1852 uint64_t previous_content_id) override { | 1853 uint64_t previous_content_id) override { |
| 1853 NOTREACHED(); | 1854 NOTREACHED(); |
| 1854 return nullptr; | 1855 return nullptr; |
| 1855 } | 1856 } |
| 1856 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override {} | 1857 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override {} |
| 1857 }; | 1858 }; |
| 1858 | 1859 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1942 void ScheduleTasks(TaskGraph* graph) override { | 1943 void ScheduleTasks(TaskGraph* graph) override { |
| 1943 for (const auto& node : graph->nodes) { | 1944 for (const auto& node : graph->nodes) { |
| 1944 TileTask* task = static_cast<TileTask*>(node.task); | 1945 TileTask* task = static_cast<TileTask*>(node.task); |
| 1945 // Triggers a call to AcquireBufferForRaster. | 1946 // Triggers a call to AcquireBufferForRaster. |
| 1946 task->ScheduleOnOriginThread(this); | 1947 task->ScheduleOnOriginThread(this); |
| 1947 // Calls TileManager as though task was cancelled. | 1948 // Calls TileManager as though task was cancelled. |
| 1948 task->CompleteOnOriginThread(this); | 1949 task->CompleteOnOriginThread(this); |
| 1949 } | 1950 } |
| 1950 } | 1951 } |
| 1951 | 1952 |
| 1952 // TileTaskClient methods. | 1953 // RasterBufferProvider methods. |
| 1953 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( | 1954 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( |
| 1954 const Resource* resource, | 1955 const Resource* resource, |
| 1955 uint64_t resource_content_id, | 1956 uint64_t resource_content_id, |
| 1956 uint64_t previous_content_id) override { | 1957 uint64_t previous_content_id) override { |
| 1957 EXPECT_EQ(expected_resource_id_, resource_content_id); | 1958 EXPECT_EQ(expected_resource_id_, resource_content_id); |
| 1958 return nullptr; | 1959 return nullptr; |
| 1959 } | 1960 } |
| 1960 | 1961 |
| 1961 private: | 1962 private: |
| 1962 uint64_t expected_resource_id_; | 1963 uint64_t expected_resource_id_; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2029 | 2030 |
| 2030 // Ensures that the tile manager does not attempt to reuse tiles when partial | 2031 // Ensures that the tile manager does not attempt to reuse tiles when partial |
| 2031 // raster is disabled. | 2032 // raster is disabled. |
| 2032 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { | 2033 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { |
| 2033 RunPartialRasterCheck(std::move(host_impl_), | 2034 RunPartialRasterCheck(std::move(host_impl_), |
| 2034 false /* partial_raster_enabled */); | 2035 false /* partial_raster_enabled */); |
| 2035 } | 2036 } |
| 2036 | 2037 |
| 2037 } // namespace | 2038 } // namespace |
| 2038 } // namespace cc | 2039 } // namespace cc |
| OLD | NEW |