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