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 "cc/resources/raster_worker_pool.h" | 7 #include "cc/resources/raster_worker_pool.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 class FakeRasterWorkerPool : public RasterWorkerPool { | 13 class FakeRasterWorkerPool : public RasterWorkerPool { |
14 public: | 14 public: |
15 FakeRasterWorkerPool() : RasterWorkerPool(NULL, 1) {} | 15 FakeRasterWorkerPool() : RasterWorkerPool(NULL, 1) {} |
16 | 16 |
17 virtual void ScheduleTasks(RasterTask::Queue* queue) OVERRIDE {} | 17 virtual void ScheduleTasks(RasterTask::Queue* queue) OVERRIDE {} |
| 18 virtual GLenum GetResourceFormat() const OVERRIDE { return GL_RGBA; } |
18 virtual void OnRasterTasksFinished() OVERRIDE {} | 19 virtual void OnRasterTasksFinished() OVERRIDE {} |
19 virtual void OnRasterTasksRequiredForActivationFinished() OVERRIDE {} | 20 virtual void OnRasterTasksRequiredForActivationFinished() OVERRIDE {} |
20 }; | 21 }; |
21 | 22 |
22 } // namespace | 23 } // namespace |
23 | 24 |
24 FakeTileManager::FakeTileManager(TileManagerClient* client) | 25 FakeTileManager::FakeTileManager(TileManagerClient* client) |
25 : TileManager(client, | 26 : TileManager(client, |
26 NULL, | 27 NULL, |
27 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), | 28 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), |
28 1, | 29 1, |
29 NULL, | 30 NULL) {} |
30 GL_RGBA) {} | |
31 | 31 |
32 FakeTileManager::FakeTileManager(TileManagerClient* client, | 32 FakeTileManager::FakeTileManager(TileManagerClient* client, |
33 ResourceProvider* resource_provider) | 33 ResourceProvider* resource_provider) |
34 : TileManager(client, | 34 : TileManager(client, |
35 resource_provider, | 35 resource_provider, |
36 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), | 36 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), |
37 1, | 37 1, |
38 NULL, | 38 NULL) {} |
39 resource_provider->best_texture_format()) {} | |
40 | 39 |
41 FakeTileManager::~FakeTileManager() {} | 40 FakeTileManager::~FakeTileManager() {} |
42 | 41 |
43 void FakeTileManager::AssignMemoryToTiles() { | 42 void FakeTileManager::AssignMemoryToTiles() { |
44 tiles_for_raster.clear(); | 43 tiles_for_raster.clear(); |
45 all_tiles.Clear(); | 44 all_tiles.Clear(); |
46 | 45 |
47 GetPrioritizedTileSet(&all_tiles); | 46 GetPrioritizedTileSet(&all_tiles); |
48 AssignGpuMemoryToTiles(&all_tiles, &tiles_for_raster); | 47 AssignGpuMemoryToTiles(&all_tiles, &tiles_for_raster); |
49 } | 48 } |
50 | 49 |
51 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { | 50 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { |
52 return std::find(tiles_for_raster.begin(), | 51 return std::find(tiles_for_raster.begin(), |
53 tiles_for_raster.end(), | 52 tiles_for_raster.end(), |
54 tile) != tiles_for_raster.end(); | 53 tile) != tiles_for_raster.end(); |
55 } | 54 } |
56 | 55 |
57 } // namespace cc | 56 } // namespace cc |
OLD | NEW |