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

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

Issue 2235623003: cc: Add gfx::ColorSpace to cc::ResourceProvider resource creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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/trees/layer_tree_host_impl.cc » ('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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 ManagedMemoryPolicy policy = host_impl()->ActualManagedMemoryPolicy(); 1320 ManagedMemoryPolicy policy = host_impl()->ActualManagedMemoryPolicy();
1321 policy.bytes_limit_when_visible = ResourceUtil::UncheckedSizeInBytes<size_t>( 1321 policy.bytes_limit_when_visible = ResourceUtil::UncheckedSizeInBytes<size_t>(
1322 gfx::Size(256, 256), RGBA_8888); 1322 gfx::Size(256, 256), RGBA_8888);
1323 host_impl()->SetMemoryPolicy(policy); 1323 host_impl()->SetMemoryPolicy(policy);
1324 1324
1325 EXPECT_FALSE(host_impl()->is_likely_to_require_a_draw()); 1325 EXPECT_FALSE(host_impl()->is_likely_to_require_a_draw());
1326 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); 1326 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state());
1327 EXPECT_TRUE(host_impl()->is_likely_to_require_a_draw()); 1327 EXPECT_TRUE(host_impl()->is_likely_to_require_a_draw());
1328 1328
1329 Resource* resource = host_impl()->resource_pool()->AcquireResource( 1329 Resource* resource = host_impl()->resource_pool()->AcquireResource(
1330 gfx::Size(256, 256), RGBA_8888); 1330 gfx::Size(256, 256), RGBA_8888, gfx::ColorSpace());
1331 1331
1332 host_impl()->tile_manager()->CheckIfMoreTilesNeedToBePreparedForTesting(); 1332 host_impl()->tile_manager()->CheckIfMoreTilesNeedToBePreparedForTesting();
1333 EXPECT_FALSE(host_impl()->is_likely_to_require_a_draw()); 1333 EXPECT_FALSE(host_impl()->is_likely_to_require_a_draw());
1334 1334
1335 host_impl()->resource_pool()->ReleaseResource(resource); 1335 host_impl()->resource_pool()->ReleaseResource(resource);
1336 } 1336 }
1337 1337
1338 TEST_F(TileManagerTilePriorityQueueTest, DefaultMemoryPolicy) { 1338 TEST_F(TileManagerTilePriorityQueueTest, DefaultMemoryPolicy) {
1339 const gfx::Size layer_bounds(1000, 1000); 1339 const gfx::Size layer_bounds(1000, 1000);
1340 host_impl()->SetViewportSize(layer_bounds); 1340 host_impl()->SetViewportSize(layer_bounds);
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1832 // raster task we see is created with |kExpectedId|. 1832 // raster task we see is created with |kExpectedId|.
1833 FakeTileTaskManagerImpl tile_task_manager; 1833 FakeTileTaskManagerImpl tile_task_manager;
1834 host_impl->tile_manager()->SetTileTaskManagerForTesting(&tile_task_manager); 1834 host_impl->tile_manager()->SetTileTaskManagerForTesting(&tile_task_manager);
1835 1835
1836 VerifyResourceContentIdRasterBufferProvider raster_buffer_provider( 1836 VerifyResourceContentIdRasterBufferProvider raster_buffer_provider(
1837 kExpectedId); 1837 kExpectedId);
1838 host_impl->tile_manager()->SetRasterBufferProviderForTesting( 1838 host_impl->tile_manager()->SetRasterBufferProviderForTesting(
1839 &raster_buffer_provider); 1839 &raster_buffer_provider);
1840 1840
1841 // Ensure there's a resource with our |kInvalidatedId| in the resource pool. 1841 // Ensure there's a resource with our |kInvalidatedId| in the resource pool.
1842 auto* resource = 1842 auto* resource = host_impl->resource_pool()->AcquireResource(
1843 host_impl->resource_pool()->AcquireResource(kTileSize, RGBA_8888); 1843 kTileSize, RGBA_8888, gfx::ColorSpace());
1844 host_impl->resource_pool()->OnContentReplaced(resource->id(), kInvalidatedId); 1844 host_impl->resource_pool()->OnContentReplaced(resource->id(), kInvalidatedId);
1845 host_impl->resource_pool()->ReleaseResource(resource); 1845 host_impl->resource_pool()->ReleaseResource(resource);
1846 host_impl->resource_pool()->CheckBusyResources(); 1846 host_impl->resource_pool()->CheckBusyResources();
1847 1847
1848 scoped_refptr<FakeRasterSource> pending_raster_source = 1848 scoped_refptr<FakeRasterSource> pending_raster_source =
1849 FakeRasterSource::CreateFilled(kTileSize); 1849 FakeRasterSource::CreateFilled(kTileSize);
1850 host_impl->CreatePendingTree(); 1850 host_impl->CreatePendingTree();
1851 LayerTreeImpl* pending_tree = host_impl->pending_tree(); 1851 LayerTreeImpl* pending_tree = host_impl->pending_tree();
1852 1852
1853 // Steal from the recycled tree. 1853 // Steal from the recycled tree.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 } 1888 }
1889 1889
1890 // Ensures that the tile manager does not attempt to reuse tiles when partial 1890 // Ensures that the tile manager does not attempt to reuse tiles when partial
1891 // raster is disabled. 1891 // raster is disabled.
1892 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { 1892 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) {
1893 RunPartialRasterCheck(TakeHostImpl(), false /* partial_raster_enabled */); 1893 RunPartialRasterCheck(TakeHostImpl(), false /* partial_raster_enabled */);
1894 } 1894 }
1895 1895
1896 } // namespace 1896 } // namespace
1897 } // namespace cc 1897 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/tile_manager.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698