| 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 base::LazyInstance<FakeRasterBufferProviderImpl> g_fake_raster_buffer_provider = | 27 base::LazyInstance<FakeRasterBufferProviderImpl> g_fake_raster_buffer_provider = |
| 28 LAZY_INSTANCE_INITIALIZER; | 28 LAZY_INSTANCE_INITIALIZER; |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 FakeTileManager::FakeTileManager(TileManagerClient* client) | 32 FakeTileManager::FakeTileManager(TileManagerClient* client) |
| 33 : TileManager(client, | 33 : TileManager(client, |
| 34 base::ThreadTaskRunnerHandle::Get().get(), | 34 base::ThreadTaskRunnerHandle::Get().get(), |
| 35 std::numeric_limits<size_t>::max(), | 35 std::numeric_limits<size_t>::max(), |
| 36 false /* use_partial_raster */), | 36 false /* use_partial_raster */), |
| 37 image_decode_controller_( | 37 image_decode_cache_( |
| 38 ResourceFormat::RGBA_8888, | 38 ResourceFormat::RGBA_8888, |
| 39 LayerTreeSettings().software_decoded_image_budget_bytes) { | 39 LayerTreeSettings().software_decoded_image_budget_bytes) { |
| 40 SetResources(nullptr, &image_decode_controller_, | 40 SetResources( |
| 41 g_synchronous_task_graph_runner.Pointer(), | 41 nullptr, &image_decode_cache_, g_synchronous_task_graph_runner.Pointer(), |
| 42 g_fake_raster_buffer_provider.Pointer(), | 42 g_fake_raster_buffer_provider.Pointer(), |
| 43 std::numeric_limits<size_t>::max(), | 43 std::numeric_limits<size_t>::max(), false /* use_gpu_rasterization */); |
| 44 false /* use_gpu_rasterization */); | |
| 45 SetTileTaskManagerForTesting(base::MakeUnique<FakeTileTaskManagerImpl>()); | 44 SetTileTaskManagerForTesting(base::MakeUnique<FakeTileTaskManagerImpl>()); |
| 46 } | 45 } |
| 47 | 46 |
| 48 FakeTileManager::FakeTileManager(TileManagerClient* client, | 47 FakeTileManager::FakeTileManager(TileManagerClient* client, |
| 49 ResourcePool* resource_pool) | 48 ResourcePool* resource_pool) |
| 50 : TileManager(client, | 49 : TileManager(client, |
| 51 base::ThreadTaskRunnerHandle::Get().get(), | 50 base::ThreadTaskRunnerHandle::Get().get(), |
| 52 std::numeric_limits<size_t>::max(), | 51 std::numeric_limits<size_t>::max(), |
| 53 false /* use_partial_raster */), | 52 false /* use_partial_raster */), |
| 54 image_decode_controller_( | 53 image_decode_cache_( |
| 55 ResourceFormat::RGBA_8888, | 54 ResourceFormat::RGBA_8888, |
| 56 LayerTreeSettings().software_decoded_image_budget_bytes) { | 55 LayerTreeSettings().software_decoded_image_budget_bytes) { |
| 57 SetResources(resource_pool, &image_decode_controller_, | 56 SetResources(resource_pool, &image_decode_cache_, |
| 58 g_synchronous_task_graph_runner.Pointer(), | 57 g_synchronous_task_graph_runner.Pointer(), |
| 59 g_fake_raster_buffer_provider.Pointer(), | 58 g_fake_raster_buffer_provider.Pointer(), |
| 60 std::numeric_limits<size_t>::max(), | 59 std::numeric_limits<size_t>::max(), |
| 61 false /* use_gpu_rasterization */); | 60 false /* use_gpu_rasterization */); |
| 62 SetTileTaskManagerForTesting(base::MakeUnique<FakeTileTaskManagerImpl>()); | 61 SetTileTaskManagerForTesting(base::MakeUnique<FakeTileTaskManagerImpl>()); |
| 63 } | 62 } |
| 64 | 63 |
| 65 FakeTileManager::~FakeTileManager() {} | 64 FakeTileManager::~FakeTileManager() {} |
| 66 | 65 |
| 67 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { | 66 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { |
| 68 return std::find(tiles_for_raster.begin(), | 67 return std::find(tiles_for_raster.begin(), |
| 69 tiles_for_raster.end(), | 68 tiles_for_raster.end(), |
| 70 tile) != tiles_for_raster.end(); | 69 tile) != tiles_for_raster.end(); |
| 71 } | 70 } |
| 72 | 71 |
| 73 void FakeTileManager::Release(Tile* tile) { | 72 void FakeTileManager::Release(Tile* tile) { |
| 74 TileManager::Release(tile); | 73 TileManager::Release(tile); |
| 75 | 74 |
| 76 FreeResourcesForReleasedTiles(); | 75 FreeResourcesForReleasedTiles(); |
| 77 CleanUpReleasedTiles(); | 76 CleanUpReleasedTiles(); |
| 78 } | 77 } |
| 79 | 78 |
| 80 } // namespace cc | 79 } // namespace cc |
| OLD | NEW |