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 "cc/resources/raster_worker_pool.h" | 10 #include "cc/resources/raster_worker_pool.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 FakeTileManager::FakeTileManager(TileManagerClient* client, | 67 FakeTileManager::FakeTileManager(TileManagerClient* client, |
68 ResourceProvider* resource_provider, | 68 ResourceProvider* resource_provider, |
69 size_t raster_task_limit_bytes) | 69 size_t raster_task_limit_bytes) |
70 : TileManager(client, | 70 : TileManager(client, |
71 resource_provider, | 71 resource_provider, |
72 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), | 72 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), |
73 raster_task_limit_bytes, | 73 raster_task_limit_bytes, |
74 NULL) {} | 74 NULL) {} |
75 | 75 |
76 FakeTileManager::~FakeTileManager() {} | 76 FakeTileManager::~FakeTileManager() { |
| 77 RasterWorkerPoolForTesting()->Shutdown(); |
| 78 RasterWorkerPoolForTesting()->CheckForCompletedTasks(); |
| 79 } |
77 | 80 |
78 void FakeTileManager::AssignMemoryToTiles( | 81 void FakeTileManager::AssignMemoryToTiles( |
79 const GlobalStateThatImpactsTilePriority& state) { | 82 const GlobalStateThatImpactsTilePriority& state) { |
80 tiles_for_raster.clear(); | 83 tiles_for_raster.clear(); |
81 all_tiles.Clear(); | 84 all_tiles.Clear(); |
82 | 85 |
83 SetGlobalStateForTesting(state); | 86 SetGlobalStateForTesting(state); |
84 GetTilesWithAssignedBins(&all_tiles); | 87 GetTilesWithAssignedBins(&all_tiles); |
85 AssignGpuMemoryToTiles(&all_tiles, &tiles_for_raster); | 88 AssignGpuMemoryToTiles(&all_tiles, &tiles_for_raster); |
86 } | 89 } |
87 | 90 |
88 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { | 91 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { |
89 return std::find(tiles_for_raster.begin(), | 92 return std::find(tiles_for_raster.begin(), |
90 tiles_for_raster.end(), | 93 tiles_for_raster.end(), |
91 tile) != tiles_for_raster.end(); | 94 tile) != tiles_for_raster.end(); |
92 } | 95 } |
93 | 96 |
94 void FakeTileManager::CheckForCompletedTasks() { | 97 void FakeTileManager::CheckForCompletedTasks() { |
95 RasterWorkerPoolForTesting()->CheckForCompletedTasks(); | 98 RasterWorkerPoolForTesting()->CheckForCompletedTasks(); |
96 } | 99 } |
97 | 100 |
98 void FakeTileManager::Release(Tile* tile) { | 101 void FakeTileManager::Release(Tile* tile) { |
99 TileManager::Release(tile); | 102 TileManager::Release(tile); |
100 CleanUpReleasedTiles(); | 103 CleanUpReleasedTiles(); |
101 } | 104 } |
102 | 105 |
103 } // namespace cc | 106 } // namespace cc |
OLD | NEW |