| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/test/fake_tile_manager.h" | 5 #include "cc/test/fake_tile_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 base::LazyInstance<FakeRasterBufferProviderImpl> g_fake_raster_buffer_provider = | 28 base::LazyInstance<FakeRasterBufferProviderImpl> g_fake_raster_buffer_provider = |
| 29 LAZY_INSTANCE_INITIALIZER; | 29 LAZY_INSTANCE_INITIALIZER; |
| 30 | 30 |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| 33 FakeTileManager::FakeTileManager(TileManagerClient* client) | 33 FakeTileManager::FakeTileManager(TileManagerClient* client) |
| 34 : TileManager(client, | 34 : TileManager(client, |
| 35 base::ThreadTaskRunnerHandle::Get().get(), | 35 base::ThreadTaskRunnerHandle::Get().get(), |
| 36 std::numeric_limits<size_t>::max(), | 36 std::numeric_limits<size_t>::max(), |
| 37 false /* use_partial_raster */), | 37 false /* use_partial_raster */, |
| 38 false /* check_tile_priority_inversion */), |
| 38 image_decode_cache_( | 39 image_decode_cache_( |
| 39 ResourceFormat::RGBA_8888, | 40 ResourceFormat::RGBA_8888, |
| 40 LayerTreeSettings().software_decoded_image_budget_bytes) { | 41 LayerTreeSettings().software_decoded_image_budget_bytes) { |
| 41 SetResources( | 42 SetResources( |
| 42 nullptr, &image_decode_cache_, g_synchronous_task_graph_runner.Pointer(), | 43 nullptr, &image_decode_cache_, g_synchronous_task_graph_runner.Pointer(), |
| 43 g_fake_raster_buffer_provider.Pointer(), | 44 g_fake_raster_buffer_provider.Pointer(), |
| 44 std::numeric_limits<size_t>::max(), false /* use_gpu_rasterization */); | 45 std::numeric_limits<size_t>::max(), false /* use_gpu_rasterization */); |
| 45 SetTileTaskManagerForTesting(base::MakeUnique<FakeTileTaskManagerImpl>()); | 46 SetTileTaskManagerForTesting(base::MakeUnique<FakeTileTaskManagerImpl>()); |
| 46 } | 47 } |
| 47 | 48 |
| 48 FakeTileManager::FakeTileManager(TileManagerClient* client, | 49 FakeTileManager::FakeTileManager(TileManagerClient* client, |
| 49 ResourcePool* resource_pool) | 50 ResourcePool* resource_pool) |
| 50 : TileManager(client, | 51 : TileManager(client, |
| 51 base::ThreadTaskRunnerHandle::Get().get(), | 52 base::ThreadTaskRunnerHandle::Get().get(), |
| 52 std::numeric_limits<size_t>::max(), | 53 std::numeric_limits<size_t>::max(), |
| 53 false /* use_partial_raster */), | 54 false /* use_partial_raster */, |
| 55 false /* check_tile_priority_inversion */), |
| 54 image_decode_cache_( | 56 image_decode_cache_( |
| 55 ResourceFormat::RGBA_8888, | 57 ResourceFormat::RGBA_8888, |
| 56 LayerTreeSettings().software_decoded_image_budget_bytes) { | 58 LayerTreeSettings().software_decoded_image_budget_bytes) { |
| 57 SetResources(resource_pool, &image_decode_cache_, | 59 SetResources(resource_pool, &image_decode_cache_, |
| 58 g_synchronous_task_graph_runner.Pointer(), | 60 g_synchronous_task_graph_runner.Pointer(), |
| 59 g_fake_raster_buffer_provider.Pointer(), | 61 g_fake_raster_buffer_provider.Pointer(), |
| 60 std::numeric_limits<size_t>::max(), | 62 std::numeric_limits<size_t>::max(), |
| 61 false /* use_gpu_rasterization */); | 63 false /* use_gpu_rasterization */); |
| 62 SetTileTaskManagerForTesting(base::MakeUnique<FakeTileTaskManagerImpl>()); | 64 SetTileTaskManagerForTesting(base::MakeUnique<FakeTileTaskManagerImpl>()); |
| 63 } | 65 } |
| 64 | 66 |
| 65 FakeTileManager::~FakeTileManager() {} | 67 FakeTileManager::~FakeTileManager() {} |
| 66 | 68 |
| 67 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { | 69 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { |
| 68 return std::find(tiles_for_raster.begin(), | 70 return std::find(tiles_for_raster.begin(), |
| 69 tiles_for_raster.end(), | 71 tiles_for_raster.end(), |
| 70 tile) != tiles_for_raster.end(); | 72 tile) != tiles_for_raster.end(); |
| 71 } | 73 } |
| 72 | 74 |
| 73 void FakeTileManager::Release(Tile* tile) { | 75 void FakeTileManager::Release(Tile* tile) { |
| 74 TileManager::Release(tile); | 76 TileManager::Release(tile); |
| 75 | 77 |
| 76 FreeResourcesForReleasedTiles(); | 78 FreeResourcesForReleasedTiles(); |
| 77 CleanUpReleasedTiles(); | 79 CleanUpReleasedTiles(); |
| 78 } | 80 } |
| 79 | 81 |
| 80 } // namespace cc | 82 } // namespace cc |
| OLD | NEW |