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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 TaskDeque completed_tasks_; | 77 TaskDeque completed_tasks_; |
78 }; | 78 }; |
79 | 79 |
80 } // namespace | 80 } // namespace |
81 | 81 |
82 FakeTileManager::FakeTileManager(TileManagerClient* client) | 82 FakeTileManager::FakeTileManager(TileManagerClient* client) |
83 : TileManager(client, | 83 : TileManager(client, |
84 NULL, | 84 NULL, |
85 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), | 85 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), |
86 std::numeric_limits<unsigned>::max(), | 86 std::numeric_limits<unsigned>::max(), |
87 NULL) {} | 87 NULL, |
| 88 true) {} |
88 | 89 |
89 FakeTileManager::FakeTileManager(TileManagerClient* client, | 90 FakeTileManager::FakeTileManager(TileManagerClient* client, |
90 ResourceProvider* resource_provider) | 91 ResourceProvider* resource_provider) |
91 : TileManager(client, | 92 : TileManager(client, |
92 resource_provider, | 93 resource_provider, |
93 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), | 94 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), |
94 std::numeric_limits<unsigned>::max(), | 95 std::numeric_limits<unsigned>::max(), |
95 NULL) {} | 96 NULL, |
| 97 true) {} |
96 | 98 |
97 FakeTileManager::FakeTileManager(TileManagerClient* client, | 99 FakeTileManager::FakeTileManager(TileManagerClient* client, |
98 ResourceProvider* resource_provider, | 100 ResourceProvider* resource_provider, |
| 101 bool allow_on_demand_raster) |
| 102 : TileManager(client, |
| 103 resource_provider, |
| 104 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), |
| 105 std::numeric_limits<unsigned>::max(), |
| 106 NULL, |
| 107 allow_on_demand_raster) {} |
| 108 |
| 109 FakeTileManager::FakeTileManager(TileManagerClient* client, |
| 110 ResourceProvider* resource_provider, |
99 size_t raster_task_limit_bytes) | 111 size_t raster_task_limit_bytes) |
100 : TileManager(client, | 112 : TileManager(client, |
101 resource_provider, | 113 resource_provider, |
102 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), | 114 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), |
103 raster_task_limit_bytes, | 115 raster_task_limit_bytes, |
104 NULL) {} | 116 NULL, |
| 117 true) {} |
105 | 118 |
106 FakeTileManager::~FakeTileManager() {} | 119 FakeTileManager::~FakeTileManager() {} |
107 | 120 |
108 void FakeTileManager::AssignMemoryToTiles( | 121 void FakeTileManager::AssignMemoryToTiles( |
109 const GlobalStateThatImpactsTilePriority& state) { | 122 const GlobalStateThatImpactsTilePriority& state) { |
110 tiles_for_raster.clear(); | 123 tiles_for_raster.clear(); |
111 all_tiles.Clear(); | 124 all_tiles.Clear(); |
112 | 125 |
113 SetGlobalStateForTesting(state); | 126 SetGlobalStateForTesting(state); |
114 GetTilesWithAssignedBins(&all_tiles); | 127 GetTilesWithAssignedBins(&all_tiles); |
115 AssignGpuMemoryToTiles(&all_tiles, &tiles_for_raster); | 128 AssignGpuMemoryToTiles(&all_tiles, &tiles_for_raster); |
116 } | 129 } |
117 | 130 |
118 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { | 131 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { |
119 return std::find(tiles_for_raster.begin(), | 132 return std::find(tiles_for_raster.begin(), |
120 tiles_for_raster.end(), | 133 tiles_for_raster.end(), |
121 tile) != tiles_for_raster.end(); | 134 tile) != tiles_for_raster.end(); |
122 } | 135 } |
123 | 136 |
124 void FakeTileManager::CheckForCompletedTasks() { | 137 void FakeTileManager::CheckForCompletedTasks() { |
125 RasterWorkerPoolForTesting()->CheckForCompletedTasks(); | 138 RasterWorkerPoolForTesting()->CheckForCompletedTasks(); |
126 } | 139 } |
127 | 140 |
| 141 void FakeTileManager::DidFinishRunningTasksForTesting() { |
| 142 DidFinishRunningTasks(); |
| 143 } |
| 144 |
128 void FakeTileManager::Release(Tile* tile) { | 145 void FakeTileManager::Release(Tile* tile) { |
129 TileManager::Release(tile); | 146 TileManager::Release(tile); |
130 CleanUpReleasedTiles(); | 147 CleanUpReleasedTiles(); |
131 } | 148 } |
132 | 149 |
133 } // namespace cc | 150 } // namespace cc |
OLD | NEW |