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 } | |
80 | 77 |
81 void FakeTileManager::AssignMemoryToTiles( | 78 void FakeTileManager::AssignMemoryToTiles( |
82 const GlobalStateThatImpactsTilePriority& state) { | 79 const GlobalStateThatImpactsTilePriority& state) { |
83 tiles_for_raster.clear(); | 80 tiles_for_raster.clear(); |
84 all_tiles.Clear(); | 81 all_tiles.Clear(); |
85 | 82 |
86 SetGlobalStateForTesting(state); | 83 SetGlobalStateForTesting(state); |
87 GetTilesWithAssignedBins(&all_tiles); | 84 GetTilesWithAssignedBins(&all_tiles); |
88 AssignGpuMemoryToTiles(&all_tiles, &tiles_for_raster); | 85 AssignGpuMemoryToTiles(&all_tiles, &tiles_for_raster); |
89 } | 86 } |
90 | 87 |
91 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { | 88 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { |
92 return std::find(tiles_for_raster.begin(), | 89 return std::find(tiles_for_raster.begin(), |
93 tiles_for_raster.end(), | 90 tiles_for_raster.end(), |
94 tile) != tiles_for_raster.end(); | 91 tile) != tiles_for_raster.end(); |
95 } | 92 } |
96 | 93 |
97 void FakeTileManager::CheckForCompletedTasks() { | 94 void FakeTileManager::CheckForCompletedTasks() { |
98 RasterWorkerPoolForTesting()->CheckForCompletedTasks(); | 95 RasterWorkerPoolForTesting()->CheckForCompletedTasks(); |
99 } | 96 } |
100 | 97 |
101 void FakeTileManager::Release(Tile* tile) { | 98 void FakeTileManager::Release(Tile* tile) { |
102 TileManager::Release(tile); | 99 TileManager::Release(tile); |
103 CleanUpReleasedTiles(); | 100 CleanUpReleasedTiles(); |
104 } | 101 } |
105 | 102 |
106 } // namespace cc | 103 } // namespace cc |
OLD | NEW |