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

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

Issue 1866043006: cc: Remove ScheduleOnOriginThread() and CompleteOnOriginThread(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip Created 4 years, 8 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
« cc/tiles/tile_manager.cc ('K') | « cc/tiles/tile_manager_perftest.cc ('k') | no next file » | 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "cc/playback/raster_source.h" 10 #include "cc/playback/raster_source.h"
(...skipping 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after
1820 } 1820 }
1821 1821
1822 // Fake TileTaskRunner that just no-ops all calls. 1822 // Fake TileTaskRunner that just no-ops all calls.
1823 class FakeTileTaskRunner : public TileTaskRunner, public TileTaskClient { 1823 class FakeTileTaskRunner : public TileTaskRunner, public TileTaskClient {
1824 public: 1824 public:
1825 FakeTileTaskRunner() {} 1825 FakeTileTaskRunner() {}
1826 ~FakeTileTaskRunner() override {} 1826 ~FakeTileTaskRunner() override {}
1827 1827
1828 // TileTaskRunner methods. 1828 // TileTaskRunner methods.
1829 void Shutdown() override {} 1829 void Shutdown() override {}
1830 void CheckForCompletedTasks() override {} 1830 void CollectCompletedTasks(Task::Vector* completed_tasks) override {}
1831 ResourceFormat GetResourceFormat(bool must_support_alpha) const override { 1831 ResourceFormat GetResourceFormat(bool must_support_alpha) const override {
1832 return ResourceFormat::RGBA_8888; 1832 return ResourceFormat::RGBA_8888;
1833 } 1833 }
1834 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override { 1834 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override {
1835 return false; 1835 return false;
1836 } 1836 }
1837 1837
1838 TileTaskClient* AsTileTaskClient() override { return this; }
1839
1838 void ScheduleTasks(TaskGraph* graph) override {} 1840 void ScheduleTasks(TaskGraph* graph) override {}
1839 1841
1840 // TileTaskClient methods. 1842 // TileTaskClient methods.
1841 scoped_ptr<RasterBuffer> AcquireBufferForRaster( 1843 scoped_ptr<RasterBuffer> AcquireBufferForRaster(
1842 const Resource* resource, 1844 const Resource* resource,
1843 uint64_t resource_content_id, 1845 uint64_t resource_content_id,
1844 uint64_t previous_content_id) override { 1846 uint64_t previous_content_id) override {
1845 NOTREACHED(); 1847 NOTREACHED();
1846 return nullptr; 1848 return nullptr;
1847 } 1849 }
1848 void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override {} 1850 void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override {}
1849 }; 1851 };
1850 1852
1851 // Fake TileTaskRunner that just cancels all scheduled tasks immediately. 1853 // Fake TileTaskRunner that just cancels all scheduled tasks immediately.
1852 class CancellingTileTaskRunner : public FakeTileTaskRunner { 1854 class CancellingTileTaskRunner : public FakeTileTaskRunner {
1853 public: 1855 public:
1854 CancellingTileTaskRunner() {} 1856 CancellingTileTaskRunner() {}
1855 ~CancellingTileTaskRunner() override {} 1857 ~CancellingTileTaskRunner() override {}
1856 1858
1857 void ScheduleTasks(TaskGraph* graph) override { 1859 void ScheduleTasks(TaskGraph* graph) override {
1858 // Just call CompleteOnOriginThread on each item in the queue. As none of 1860 // Don't do anything. As none of these items have scheduled yet, they will
1859 // these items have run yet, they will be treated as cancelled tasks. 1861 // be treated as cancelled tasks.
1860 for (const auto& node : graph->nodes) {
1861 static_cast<TileTask*>(node.task)->CompleteOnOriginThread(this);
1862 }
1863 } 1862 }
1864 }; 1863 };
1865 1864
1866 class PartialRasterTileManagerTest : public TileManagerTest { 1865 class PartialRasterTileManagerTest : public TileManagerTest {
1867 public: 1866 public:
1868 void CustomizeSettings(LayerTreeSettings* settings) override { 1867 void CustomizeSettings(LayerTreeSettings* settings) override {
1869 settings->use_partial_raster = true; 1868 settings->use_partial_raster = true;
1870 } 1869 }
1871 }; 1870 };
1872 1871
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 host_impl_ = nullptr; 1923 host_impl_ = nullptr;
1925 } 1924 }
1926 1925
1927 // Fake TileTaskRunner that verifies the resource content ID of raster tasks. 1926 // Fake TileTaskRunner that verifies the resource content ID of raster tasks.
1928 class VerifyResourceContentIdTileTaskRunner : public FakeTileTaskRunner { 1927 class VerifyResourceContentIdTileTaskRunner : public FakeTileTaskRunner {
1929 public: 1928 public:
1930 explicit VerifyResourceContentIdTileTaskRunner(uint64_t expected_resource_id) 1929 explicit VerifyResourceContentIdTileTaskRunner(uint64_t expected_resource_id)
1931 : expected_resource_id_(expected_resource_id) {} 1930 : expected_resource_id_(expected_resource_id) {}
1932 ~VerifyResourceContentIdTileTaskRunner() override {} 1931 ~VerifyResourceContentIdTileTaskRunner() override {}
1933 1932
1934 void ScheduleTasks(TaskGraph* graph) override { 1933 void ScheduleTasks(TaskGraph* graph) override {}
1935 for (const auto& node : graph->nodes) {
1936 TileTask* task = static_cast<TileTask*>(node.task);
1937 // Triggers a call to AcquireBufferForRaster.
1938 task->ScheduleOnOriginThread(this);
1939 // Calls TileManager as though task was cancelled.
1940 task->CompleteOnOriginThread(this);
1941 }
1942 }
1943 1934
1944 // TileTaskClient methods. 1935 // TileTaskClient methods.
1945 scoped_ptr<RasterBuffer> AcquireBufferForRaster( 1936 scoped_ptr<RasterBuffer> AcquireBufferForRaster(
1946 const Resource* resource, 1937 const Resource* resource,
1947 uint64_t resource_content_id, 1938 uint64_t resource_content_id,
1948 uint64_t previous_content_id) override { 1939 uint64_t previous_content_id) override {
1949 EXPECT_EQ(expected_resource_id_, resource_content_id); 1940 EXPECT_EQ(expected_resource_id_, resource_content_id);
1950 return nullptr; 1941 return nullptr;
1951 } 1942 }
1952 1943
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 2012
2022 // Ensures that the tile manager does not attempt to reuse tiles when partial 2013 // Ensures that the tile manager does not attempt to reuse tiles when partial
2023 // raster is disabled. 2014 // raster is disabled.
2024 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { 2015 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) {
2025 RunPartialRasterCheck(std::move(host_impl_), 2016 RunPartialRasterCheck(std::move(host_impl_),
2026 false /* partial_raster_enabled */); 2017 false /* partial_raster_enabled */);
2027 } 2018 }
2028 2019
2029 } // namespace 2020 } // namespace
2030 } // namespace cc 2021 } // namespace cc
OLDNEW
« cc/tiles/tile_manager.cc ('K') | « cc/tiles/tile_manager_perftest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698