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

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

Issue 2046033002: Revert of cc: Add mailbox support to ResourceProvider write locks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@worker_context_stream
Patch Set: Created 4 years, 6 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
« no previous file with comments | « cc/tiles/tile_manager.cc ('k') | cc/tiles/tile_task_manager.h » ('j') | 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/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"
(...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after
1800 uint64_t resource_content_id, 1800 uint64_t resource_content_id,
1801 uint64_t previous_content_id) override { 1801 uint64_t previous_content_id) override {
1802 EXPECT_EQ(expected_resource_id_, resource_content_id); 1802 EXPECT_EQ(expected_resource_id_, resource_content_id);
1803 return nullptr; 1803 return nullptr;
1804 } 1804 }
1805 1805
1806 private: 1806 private:
1807 uint64_t expected_resource_id_; 1807 uint64_t expected_resource_id_;
1808 }; 1808 };
1809 1809
1810 class VerifyResourceContentIdTileTaskManager : public FakeTileTaskManagerImpl {
1811 public:
1812 explicit VerifyResourceContentIdTileTaskManager(uint64_t expected_resource_id)
1813 : FakeTileTaskManagerImpl(base::WrapUnique<RasterBufferProvider>(
1814 new VerifyResourceContentIdRasterBufferProvider(
1815 expected_resource_id))) {}
1816 ~VerifyResourceContentIdTileTaskManager() override {}
1817 };
1818
1810 // Runs a test to ensure that partial raster is either enabled or disabled, 1819 // Runs a test to ensure that partial raster is either enabled or disabled,
1811 // depending on |partial_raster_enabled|'s value. Takes ownership of host_impl 1820 // depending on |partial_raster_enabled|'s value. Takes ownership of host_impl
1812 // so that cleanup order can be controlled. 1821 // so that cleanup order can be controlled.
1813 void RunPartialRasterCheck(std::unique_ptr<LayerTreeHostImpl> host_impl, 1822 void RunPartialRasterCheck(std::unique_ptr<LayerTreeHostImpl> host_impl,
1814 bool partial_raster_enabled) { 1823 bool partial_raster_enabled) {
1815 // Pick arbitrary IDs - they don't really matter as long as they're constant. 1824 // Pick arbitrary IDs - they don't really matter as long as they're constant.
1816 const int kLayerId = 7; 1825 const int kLayerId = 7;
1817 const uint64_t kInvalidatedId = 43; 1826 const uint64_t kInvalidatedId = 43;
1818 const uint64_t kExpectedId = partial_raster_enabled ? kInvalidatedId : 0u; 1827 const uint64_t kExpectedId = partial_raster_enabled ? kInvalidatedId : 0u;
1819 const gfx::Size kTileSize(128, 128); 1828 const gfx::Size kTileSize(128, 128);
1820 1829
1821 // Create a VerifyResourceContentIdTileTaskManager to ensure that the 1830 // Create a VerifyResourceContentIdTileTaskManager to ensure that the
1822 // raster task we see is created with |kExpectedId|. 1831 // raster task we see is created with |kExpectedId|.
1823 FakeTileTaskManagerImpl tile_task_manager; 1832 VerifyResourceContentIdTileTaskManager verifying_task_manager(kExpectedId);
1824 host_impl->tile_manager()->SetTileTaskManagerForTesting(&tile_task_manager); 1833 host_impl->tile_manager()->SetTileTaskManagerForTesting(
1825 1834 &verifying_task_manager);
1826 VerifyResourceContentIdRasterBufferProvider raster_buffer_provider(
1827 kExpectedId);
1828 host_impl->tile_manager()->SetRasterBufferProviderForTesting(
1829 &raster_buffer_provider);
1830 1835
1831 // Ensure there's a resource with our |kInvalidatedId| in the resource pool. 1836 // Ensure there's a resource with our |kInvalidatedId| in the resource pool.
1832 host_impl->resource_pool()->ReleaseResource( 1837 host_impl->resource_pool()->ReleaseResource(
1833 host_impl->resource_pool()->AcquireResource(kTileSize, RGBA_8888), 1838 host_impl->resource_pool()->AcquireResource(kTileSize, RGBA_8888),
1834 kInvalidatedId); 1839 kInvalidatedId);
1835 host_impl->resource_pool()->CheckBusyResources(); 1840 host_impl->resource_pool()->CheckBusyResources();
1836 1841
1837 scoped_refptr<FakeRasterSource> pending_raster_source = 1842 scoped_refptr<FakeRasterSource> pending_raster_source =
1838 FakeRasterSource::CreateFilled(kTileSize); 1843 FakeRasterSource::CreateFilled(kTileSize);
1839 host_impl->CreatePendingTree(); 1844 host_impl->CreatePendingTree();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1877 } 1882 }
1878 1883
1879 // Ensures that the tile manager does not attempt to reuse tiles when partial 1884 // Ensures that the tile manager does not attempt to reuse tiles when partial
1880 // raster is disabled. 1885 // raster is disabled.
1881 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { 1886 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) {
1882 RunPartialRasterCheck(TakeHostImpl(), false /* partial_raster_enabled */); 1887 RunPartialRasterCheck(TakeHostImpl(), false /* partial_raster_enabled */);
1883 } 1888 }
1884 1889
1885 } // namespace 1890 } // namespace
1886 } // namespace cc 1891 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/tile_manager.cc ('k') | cc/tiles/tile_task_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698