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

Side by Side Diff: cc/tile_manager.cc

Issue 11364194: Introduce Tile Versions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month 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/tile_manager.h ('k') | cc/tile_priority.h » ('j') | 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/tile_manager.h" 5 #include "cc/tile_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
11 TileManager::TileManager(TileManagerClient* client) { 11 TileManager::TileManager(TileManagerClient* client)
12 : client_(client)
13 , manage_tiles_pending_(false)
14 {
12 } 15 }
13 16
14 TileManager::~TileManager() { 17 TileManager::~TileManager() {
15 DCHECK(registered_tiles_.size() == 0); 18 ManageTiles();
19 DCHECK(tile_versions_.size() == 0);
16 } 20 }
17 21
18 void TileManager::RegisterTile(Tile* tile) { 22 void TileManager::SetGlobalState(const GlobalStateThatImpactsTilePriority& globa l_state) {
19 registered_tiles_.push_back(tile); 23 global_state_ = global_state;
24 ScheduleManageTiles();
20 } 25 }
21 26
22 void TileManager::UnregisterTile(Tile* tile) { 27 void TileManager::ManageTiles() {
23 // TODO(nduca): Known slow. Shrug. Fish need frying. 28 // Figure out how much memory we would be willing to give out.
24 for (size_t i = 0; i < registered_tiles_.size(); i++) { 29
25 if (registered_tiles_[i] == tile) { 30 // Free up memory.
26 registered_tiles_.erase(registered_tiles_.begin() + i); 31
32 // GC old versions.
33 }
34
35 void TileManager::DidCreateTileVersion(TileVersion* version) {
36 tile_versions_.push_back(version);
37 ScheduleManageTiles();
38 }
39
40 void TileManager::DidDeleteTileVersion(TileVersion* version) {
41 for (size_t i = 0; i < tile_versions_.size(); i++) {
42 if (tile_versions_[i] == version) {
43 tile_versions_.erase(tile_versions_.begin() + i);
27 return; 44 return;
28 } 45 }
29 } 46 }
30 DCHECK(false) << "Tile " << tile << " wasnt regitered."; 47 DCHECK(false) << "Could not find tile version.";
48 }
49
50 void TileManager::WillModifyTileVersionPriority(TileVersion*, const TilePriority & new_priority) {
51 // TODO(nduca): Do something smarter if reprioritization turns out to be
52 // costly.
53 ScheduleManageTiles();
54 }
55
56 void TileManager::ScheduleManageTiles() {
57 if (manage_tiles_pending_)
58 return;
59 ScheduleManageTiles();
60 manage_tiles_pending_ = true;
31 } 61 }
32 62
33 } 63 }
OLDNEW
« no previous file with comments | « cc/tile_manager.h ('k') | cc/tile_priority.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698