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

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

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