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" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 class FakeRasterWorkerPool : public RasterWorkerPool { | 16 class FakeRasterWorkerPool : public RasterWorkerPool { |
17 public: | 17 public: |
18 FakeRasterWorkerPool() : RasterWorkerPool(NULL, 1) {} | 18 FakeRasterWorkerPool() : RasterWorkerPool(NULL) {} |
19 | 19 |
20 virtual void ScheduleTasks(RasterTask::Queue* queue) OVERRIDE { | 20 virtual void ScheduleTasks(RasterTask::Queue* queue) OVERRIDE { |
21 RasterWorkerPool::SetRasterTasks(queue); | 21 RasterWorkerPool::SetRasterTasks(queue); |
22 for (RasterTaskVector::const_iterator it = raster_tasks().begin(); | 22 for (RasterTaskVector::const_iterator it = raster_tasks().begin(); |
23 it != raster_tasks().end(); ++it) { | 23 it != raster_tasks().end(); ++it) { |
24 completed_tasks_.push_back(it->get()); | 24 completed_tasks_.push_back(it->get()); |
25 } | 25 } |
26 } | 26 } |
27 virtual void CheckForCompletedTasks() OVERRIDE { | 27 virtual void CheckForCompletedTasks() OVERRIDE { |
28 while (!completed_tasks_.empty()) { | 28 while (!completed_tasks_.empty()) { |
(...skipping 17 matching lines...) Loading... |
46 typedef std::deque<scoped_refptr<internal::RasterWorkerPoolTask> > TaskDeque; | 46 typedef std::deque<scoped_refptr<internal::RasterWorkerPoolTask> > TaskDeque; |
47 TaskDeque completed_tasks_; | 47 TaskDeque completed_tasks_; |
48 }; | 48 }; |
49 | 49 |
50 } // namespace | 50 } // namespace |
51 | 51 |
52 FakeTileManager::FakeTileManager(TileManagerClient* client) | 52 FakeTileManager::FakeTileManager(TileManagerClient* client) |
53 : TileManager(client, | 53 : TileManager(client, |
54 NULL, | 54 NULL, |
55 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), | 55 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), |
56 1, | |
57 std::numeric_limits<unsigned>::max(), | 56 std::numeric_limits<unsigned>::max(), |
58 NULL) {} | 57 NULL) {} |
59 | 58 |
60 FakeTileManager::FakeTileManager(TileManagerClient* client, | 59 FakeTileManager::FakeTileManager(TileManagerClient* client, |
61 ResourceProvider* resource_provider) | 60 ResourceProvider* resource_provider) |
62 : TileManager(client, | 61 : TileManager(client, |
63 resource_provider, | 62 resource_provider, |
64 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), | 63 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), |
65 1, | |
66 std::numeric_limits<unsigned>::max(), | 64 std::numeric_limits<unsigned>::max(), |
67 NULL) {} | 65 NULL) {} |
68 | 66 |
69 FakeTileManager::FakeTileManager(TileManagerClient* client, | 67 FakeTileManager::FakeTileManager(TileManagerClient* client, |
70 ResourceProvider* resource_provider, | 68 ResourceProvider* resource_provider, |
71 size_t raster_task_limit_bytes) | 69 size_t raster_task_limit_bytes) |
72 : TileManager(client, | 70 : TileManager(client, |
73 resource_provider, | 71 resource_provider, |
74 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), | 72 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), |
75 1, | |
76 raster_task_limit_bytes, | 73 raster_task_limit_bytes, |
77 NULL) {} | 74 NULL) {} |
78 | 75 |
79 FakeTileManager::~FakeTileManager() {} | 76 FakeTileManager::~FakeTileManager() {} |
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 |
(...skipping 11 matching lines...) Loading... |
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 |