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 | 9 |
9 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
10 #include "cc/resources/raster_buffer.h" | 11 #include "cc/resources/raster_buffer.h" |
11 #include "cc/resources/rasterizer.h" | 12 #include "cc/resources/rasterizer.h" |
12 | 13 |
13 namespace cc { | 14 namespace cc { |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 class FakeRasterizerImpl : public Rasterizer, public RasterizerTaskClient { | 18 class FakeRasterizerImpl : public Rasterizer, public RasterizerTaskClient { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 base::LazyInstance<FakeRasterizerImpl> g_fake_rasterizer = | 62 base::LazyInstance<FakeRasterizerImpl> g_fake_rasterizer = |
62 LAZY_INSTANCE_INITIALIZER; | 63 LAZY_INSTANCE_INITIALIZER; |
63 | 64 |
64 } // namespace | 65 } // namespace |
65 | 66 |
66 FakeTileManager::FakeTileManager(TileManagerClient* client) | 67 FakeTileManager::FakeTileManager(TileManagerClient* client) |
67 : TileManager(client, | 68 : TileManager(client, |
68 base::MessageLoopProxy::current(), | 69 base::MessageLoopProxy::current(), |
69 NULL, | 70 NULL, |
70 g_fake_rasterizer.Pointer(), | 71 g_fake_rasterizer.Pointer(), |
71 NULL) {} | 72 NULL, |
| 73 std::numeric_limits<size_t>::max()) { |
| 74 } |
72 | 75 |
73 FakeTileManager::FakeTileManager(TileManagerClient* client, | 76 FakeTileManager::FakeTileManager(TileManagerClient* client, |
74 ResourcePool* resource_pool) | 77 ResourcePool* resource_pool) |
75 : TileManager(client, | 78 : TileManager(client, |
76 base::MessageLoopProxy::current(), | 79 base::MessageLoopProxy::current(), |
77 resource_pool, | 80 resource_pool, |
78 g_fake_rasterizer.Pointer(), | 81 g_fake_rasterizer.Pointer(), |
79 NULL) {} | 82 NULL, |
| 83 std::numeric_limits<size_t>::max()) { |
| 84 } |
80 | 85 |
81 FakeTileManager::~FakeTileManager() {} | 86 FakeTileManager::~FakeTileManager() {} |
82 | 87 |
83 void FakeTileManager::AssignMemoryToTiles( | 88 void FakeTileManager::AssignMemoryToTiles( |
84 const GlobalStateThatImpactsTilePriority& state) { | 89 const GlobalStateThatImpactsTilePriority& state) { |
85 tiles_for_raster.clear(); | 90 tiles_for_raster.clear(); |
86 | 91 |
87 SetGlobalStateForTesting(state); | 92 SetGlobalStateForTesting(state); |
88 AssignGpuMemoryToTiles(&tiles_for_raster); | 93 AssignGpuMemoryToTiles(&tiles_for_raster); |
89 } | 94 } |
90 | 95 |
91 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { | 96 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { |
92 return std::find(tiles_for_raster.begin(), | 97 return std::find(tiles_for_raster.begin(), |
93 tiles_for_raster.end(), | 98 tiles_for_raster.end(), |
94 tile) != tiles_for_raster.end(); | 99 tile) != tiles_for_raster.end(); |
95 } | 100 } |
96 | 101 |
97 void FakeTileManager::Release(Tile* tile) { | 102 void FakeTileManager::Release(Tile* tile) { |
98 TileManager::Release(tile); | 103 TileManager::Release(tile); |
99 | 104 |
100 FreeResourcesForReleasedTiles(); | 105 FreeResourcesForReleasedTiles(); |
101 CleanUpReleasedTiles(); | 106 CleanUpReleasedTiles(); |
102 } | 107 } |
103 | 108 |
104 } // namespace cc | 109 } // namespace cc |
OLD | NEW |