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/tile_manager.h" | 5 #include "cc/tile_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 resource_pool_->SetMaxMemoryUsageBytes(global_state_.memory_limit_in_bytes); | 163 resource_pool_->SetMaxMemoryUsageBytes(global_state_.memory_limit_in_bytes); |
164 ScheduleManageTiles(); | 164 ScheduleManageTiles(); |
165 } | 165 } |
166 | 166 |
167 void TileManager::RegisterTile(Tile* tile) { | 167 void TileManager::RegisterTile(Tile* tile) { |
168 tiles_.push_back(tile); | 168 tiles_.push_back(tile); |
169 ScheduleManageTiles(); | 169 ScheduleManageTiles(); |
170 } | 170 } |
171 | 171 |
172 void TileManager::UnregisterTile(Tile* tile) { | 172 void TileManager::UnregisterTile(Tile* tile) { |
| 173 for (TileList::iterator it = tiles_with_image_decoding_tasks_.begin(); |
| 174 it != tiles_with_image_decoding_tasks_.end(); it++) { |
| 175 if (*it == tile) { |
| 176 tiles_with_image_decoding_tasks_.erase(it); |
| 177 break;; |
| 178 } |
| 179 } |
| 180 for (TileVector::iterator it = tiles_that_need_to_be_rasterized_.begin(); |
| 181 it != tiles_that_need_to_be_rasterized_.end(); it++) { |
| 182 if (*it == tile) { |
| 183 tiles_that_need_to_be_rasterized_.erase(it); |
| 184 break; |
| 185 } |
| 186 } |
173 for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); it++) { | 187 for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); it++) { |
174 if (*it == tile) { | 188 if (*it == tile) { |
175 FreeResourcesForTile(tile); | 189 FreeResourcesForTile(tile); |
176 tiles_.erase(it); | 190 tiles_.erase(it); |
177 return; | 191 return; |
178 } | 192 } |
179 } | 193 } |
180 DCHECK(false) << "Could not find tile version."; | 194 DCHECK(false) << "Could not find tile version."; |
181 } | 195 } |
182 | 196 |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 } | 615 } |
602 | 616 |
603 void TileManager::DidFinishTileInitialization(Tile* tile) { | 617 void TileManager::DidFinishTileInitialization(Tile* tile) { |
604 ManagedTileState& managed_tile_state = tile->managed_state(); | 618 ManagedTileState& managed_tile_state = tile->managed_state(); |
605 DCHECK(managed_tile_state.resource); | 619 DCHECK(managed_tile_state.resource); |
606 managed_tile_state.resource_is_being_initialized = false; | 620 managed_tile_state.resource_is_being_initialized = false; |
607 managed_tile_state.can_be_freed = true; | 621 managed_tile_state.can_be_freed = true; |
608 } | 622 } |
609 | 623 |
610 } | 624 } |
OLD | NEW |