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 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 // Sort by bin. | 218 // Sort by bin. |
219 std::sort(tiles_.begin(), tiles_.end(), BinComparator()); | 219 std::sort(tiles_.begin(), tiles_.end(), BinComparator()); |
220 | 220 |
221 // Assign gpu memory and determine what tiles need to be rasterized. | 221 // Assign gpu memory and determine what tiles need to be rasterized. |
222 AssignGpuMemoryToTiles(); | 222 AssignGpuMemoryToTiles(); |
223 | 223 |
224 // Finally, kick the rasterizer. | 224 // Finally, kick the rasterizer. |
225 DispatchMoreTasks(); | 225 DispatchMoreTasks(); |
226 } | 226 } |
227 | 227 |
228 void TileManager::CheckForCompletedSetPixels() { | 228 bool TileManager::CheckForCompletedSetPixels() { |
229 bool visible_highres_tile_was_completed = false; | |
230 | |
229 while (!tiles_with_pending_set_pixels_.empty()) { | 231 while (!tiles_with_pending_set_pixels_.empty()) { |
230 Tile* tile = tiles_with_pending_set_pixels_.front(); | 232 Tile* tile = tiles_with_pending_set_pixels_.front(); |
231 DCHECK(tile->managed_state().resource); | 233 DCHECK(tile->managed_state().resource); |
232 | 234 |
233 // Set pixel tasks complete in the order they are posted. | 235 // Set pixel tasks complete in the order they are posted. |
234 if (!resource_pool_->resource_provider()->didSetPixelsComplete( | 236 if (!resource_pool_->resource_provider()->didSetPixelsComplete( |
235 tile->managed_state().resource->id())) { | 237 tile->managed_state().resource->id())) { |
236 break; | 238 break; |
237 } | 239 } |
238 | 240 |
241 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0 && | |
242 tile->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) | |
243 visible_highres_tile_was_completed = true; | |
nduca
2013/01/12 09:14:02
why not just trigger a setNeedsRedraw here? In thi
brianderson
2013/01/12 18:48:06
I did it this way for two reasons:
1) After the d
nduca
2013/01/12 22:04:40
But look at this function. At this specific line,
brianderson
2013/01/14 18:51:12
The problem is that there can be a missmatch betwe
| |
244 | |
239 // It's now safe to release the pixel buffer. | 245 // It's now safe to release the pixel buffer. |
240 resource_pool_->resource_provider()->releasePixelBuffer( | 246 resource_pool_->resource_provider()->releasePixelBuffer( |
241 tile->managed_state().resource->id()); | 247 tile->managed_state().resource->id()); |
242 | 248 |
243 DidFinishTileInitialization(tile); | 249 DidFinishTileInitialization(tile); |
244 tiles_with_pending_set_pixels_.pop(); | 250 tiles_with_pending_set_pixels_.pop(); |
245 } | 251 } |
252 | |
253 return visible_highres_tile_was_completed; | |
246 } | 254 } |
247 | 255 |
248 void TileManager::GetRenderingStats(RenderingStats* stats) { | 256 void TileManager::GetRenderingStats(RenderingStats* stats) { |
249 raster_worker_->GetRenderingStats(stats); | 257 raster_worker_->GetRenderingStats(stats); |
250 stats->totalDeferredImageCacheHitCount = | 258 stats->totalDeferredImageCacheHitCount = |
251 rendering_stats_.totalDeferredImageCacheHitCount; | 259 rendering_stats_.totalDeferredImageCacheHitCount; |
252 stats->totalImageGatheringCount = rendering_stats_.totalImageGatheringCount; | 260 stats->totalImageGatheringCount = rendering_stats_.totalImageGatheringCount; |
253 stats->totalImageGatheringTimeInSeconds = | 261 stats->totalImageGatheringTimeInSeconds = |
254 rendering_stats_.totalImageGatheringTimeInSeconds; | 262 rendering_stats_.totalImageGatheringTimeInSeconds; |
255 } | 263 } |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
514 } | 522 } |
515 | 523 |
516 void TileManager::DidFinishTileInitialization(Tile* tile) { | 524 void TileManager::DidFinishTileInitialization(Tile* tile) { |
517 ManagedTileState& managed_tile_state = tile->managed_state(); | 525 ManagedTileState& managed_tile_state = tile->managed_state(); |
518 DCHECK(managed_tile_state.resource); | 526 DCHECK(managed_tile_state.resource); |
519 managed_tile_state.resource_is_being_initialized = false; | 527 managed_tile_state.resource_is_being_initialized = false; |
520 managed_tile_state.can_be_freed = true; | 528 managed_tile_state.can_be_freed = true; |
521 } | 529 } |
522 | 530 |
523 } // namespace cc | 531 } // namespace cc |
OLD | NEW |