| 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 <deque> | 7 #include <deque> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 base::LazyInstance<FakeTileTaskRunnerImpl> g_fake_tile_task_runner = | 60 base::LazyInstance<FakeTileTaskRunnerImpl> g_fake_tile_task_runner = |
| 61 LAZY_INSTANCE_INITIALIZER; | 61 LAZY_INSTANCE_INITIALIZER; |
| 62 | 62 |
| 63 } // namespace | 63 } // namespace |
| 64 | 64 |
| 65 FakeTileManager::FakeTileManager(TileManagerClient* client) | 65 FakeTileManager::FakeTileManager(TileManagerClient* client) |
| 66 : TileManager(client, | 66 : TileManager(client, |
| 67 base::MessageLoopProxy::current(), | 67 base::MessageLoopProxy::current(), |
| 68 NULL, | 68 NULL, |
| 69 g_fake_tile_task_runner.Pointer(), | 69 g_fake_tile_task_runner.Pointer(), |
| 70 -1, |
| 70 NULL, | 71 NULL, |
| 71 std::numeric_limits<size_t>::max()) { | 72 std::numeric_limits<size_t>::max()) { |
| 72 } | 73 } |
| 73 | 74 |
| 74 FakeTileManager::FakeTileManager(TileManagerClient* client, | 75 FakeTileManager::FakeTileManager(TileManagerClient* client, |
| 75 ResourcePool* resource_pool) | 76 ResourcePool* resource_pool) |
| 76 : TileManager(client, | 77 : TileManager(client, |
| 77 base::MessageLoopProxy::current(), | 78 base::MessageLoopProxy::current(), |
| 78 resource_pool, | 79 resource_pool, |
| 79 g_fake_tile_task_runner.Pointer(), | 80 g_fake_tile_task_runner.Pointer(), |
| 81 -1, |
| 80 NULL, | 82 NULL, |
| 81 std::numeric_limits<size_t>::max()) { | 83 std::numeric_limits<size_t>::max()) { |
| 82 } | 84 } |
| 83 | 85 |
| 84 FakeTileManager::~FakeTileManager() {} | 86 FakeTileManager::~FakeTileManager() {} |
| 85 | 87 |
| 86 void FakeTileManager::AssignMemoryToTiles( | 88 void FakeTileManager::AssignMemoryToTiles( |
| 87 const GlobalStateThatImpactsTilePriority& state) { | 89 const GlobalStateThatImpactsTilePriority& state) { |
| 88 tiles_for_raster.clear(); | 90 tiles_for_raster.clear(); |
| 89 | 91 |
| 90 SetGlobalStateForTesting(state); | 92 SetGlobalStateForTesting(state); |
| 91 AssignGpuMemoryToTiles(&tiles_for_raster); | 93 AssignGpuMemoryToTiles(&tiles_for_raster); |
| 92 } | 94 } |
| 93 | 95 |
| 94 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { | 96 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { |
| 95 return std::find(tiles_for_raster.begin(), | 97 return std::find(tiles_for_raster.begin(), |
| 96 tiles_for_raster.end(), | 98 tiles_for_raster.end(), |
| 97 tile) != tiles_for_raster.end(); | 99 tile) != tiles_for_raster.end(); |
| 98 } | 100 } |
| 99 | 101 |
| 100 void FakeTileManager::Release(Tile* tile) { | 102 void FakeTileManager::Release(Tile* tile) { |
| 101 TileManager::Release(tile); | 103 TileManager::Release(tile); |
| 102 | 104 |
| 103 FreeResourcesForReleasedTiles(); | 105 FreeResourcesForReleasedTiles(); |
| 104 CleanUpReleasedTiles(); | 106 CleanUpReleasedTiles(); |
| 105 } | 107 } |
| 106 | 108 |
| 107 } // namespace cc | 109 } // namespace cc |
| OLD | NEW |