Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: cc/test/fake_tile_manager.cc

Issue 62283012: cc: Added tile bundles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/test/fake_tile_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, 56 1,
57 std::numeric_limits<unsigned>::max(), 57 std::numeric_limits<unsigned>::max(),
58 NULL) {} 58 NULL),
59 in_bundle_cleanup_(false) {}
59 60
60 FakeTileManager::FakeTileManager(TileManagerClient* client, 61 FakeTileManager::FakeTileManager(TileManagerClient* client,
61 ResourceProvider* resource_provider) 62 ResourceProvider* resource_provider)
62 : TileManager(client, 63 : TileManager(client,
63 resource_provider, 64 resource_provider,
64 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), 65 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool),
65 1, 66 1,
66 std::numeric_limits<unsigned>::max(), 67 std::numeric_limits<unsigned>::max(),
67 NULL) {} 68 NULL),
69 in_bundle_cleanup_(false) {}
68 70
69 FakeTileManager::FakeTileManager(TileManagerClient* client, 71 FakeTileManager::FakeTileManager(TileManagerClient* client,
70 ResourceProvider* resource_provider, 72 ResourceProvider* resource_provider,
71 size_t raster_task_limit_bytes) 73 size_t raster_task_limit_bytes)
72 : TileManager(client, 74 : TileManager(client,
73 resource_provider, 75 resource_provider,
74 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool), 76 make_scoped_ptr<RasterWorkerPool>(new FakeRasterWorkerPool),
75 1, 77 1,
76 raster_task_limit_bytes, 78 raster_task_limit_bytes,
77 NULL) {} 79 NULL),
80 in_bundle_cleanup_(false) {}
78 81
79 FakeTileManager::~FakeTileManager() {} 82 FakeTileManager::~FakeTileManager() {}
80 83
81 void FakeTileManager::AssignMemoryToTiles( 84 void FakeTileManager::AssignMemoryToTiles(
82 const GlobalStateThatImpactsTilePriority& state) { 85 const GlobalStateThatImpactsTilePriority& state) {
83 tiles_for_raster.clear(); 86 tiles_for_raster.clear();
84 all_tiles.Clear(); 87 all_tiles.Clear();
85 88
86 SetGlobalStateForTesting(state); 89 SetGlobalStateForTesting(state);
87 GetTilesWithAssignedBins(&all_tiles); 90 GetTilesWithAssignedBins(&all_tiles);
88 AssignGpuMemoryToTiles(&all_tiles, &tiles_for_raster); 91 AssignGpuMemoryToTiles(&all_tiles, &tiles_for_raster);
89 } 92 }
90 93
91 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) { 94 bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) {
92 return std::find(tiles_for_raster.begin(), 95 return std::find(tiles_for_raster.begin(),
93 tiles_for_raster.end(), 96 tiles_for_raster.end(),
94 tile) != tiles_for_raster.end(); 97 tile) != tiles_for_raster.end();
95 } 98 }
96 99
97 void FakeTileManager::CheckForCompletedTasks() { 100 void FakeTileManager::CheckForCompletedTasks() {
98 RasterWorkerPoolForTesting()->CheckForCompletedTasks(); 101 RasterWorkerPoolForTesting()->CheckForCompletedTasks();
99 } 102 }
100 103
101 void FakeTileManager::Release(Tile* tile) { 104 void FakeTileManager::Release(Tile* tile) {
102 TileManager::Release(tile); 105 TileManager::Release(tile);
106 if (!in_bundle_cleanup_)
107 CleanUpReleasedTiles();
108 }
109
110 void FakeTileManager::Release(TileBundle* bundle) {
111 TileManager::Release(bundle);
112 in_bundle_cleanup_ = true;
103 CleanUpReleasedTiles(); 113 CleanUpReleasedTiles();
114 in_bundle_cleanup_ = false;
104 } 115 }
105 116
106 } // namespace cc 117 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698