Chromium Code Reviews| Index: cc/tile_manager.cc |
| diff --git a/cc/tile_manager.cc b/cc/tile_manager.cc |
| index 42b7ea331dd724eccc5b267888f4c93df9a66bcd..dfda796e80b8cd45fc1eb79bdb0e25b0504b1a20 100644 |
| --- a/cc/tile_manager.cc |
| +++ b/cc/tile_manager.cc |
| @@ -38,10 +38,14 @@ cc::TileManagerBin BinFromTilePriority(const cc::TilePriority& prio) { |
| // The amount of time for which we want to have prepainting coverage. |
| const double prepainting_window_time_seconds = 1.0; |
| const double backfling_guard_distance_pixels = 314.0; |
| + const double maximum_paint_distance_pixels = 4096.0; |
| if (prio.time_to_needed_in_seconds() == std::numeric_limits<float>::max()) |
| return cc::NEVER_BIN; |
| + if (prio.distance_to_visible_in_pixels > maximum_paint_distance_pixels) |
|
ccameron
2012/12/26 23:55:54
I discussed this with Nat earlier. If we allow the
enne (OOO)
2012/12/27 22:06:39
This seems pretty reasonable to me for the moment.
|
| + return cc::NEVER_BIN; |
| + |
| if (prio.resolution == cc::NON_IDEAL_RESOLUTION) |
| return cc::EVENTUALLY_BIN; |
| @@ -147,7 +151,8 @@ ManagedTileState::ManagedTileState() |
| can_be_freed(true), |
| resource_is_being_initialized(false), |
| contents_swizzled(false), |
| - need_to_gather_pixel_refs(true) { |
| + need_to_gather_pixel_refs(true), |
| + gpu_memmgr_stats_bin(NEVER_BIN) { |
| } |
| ManagedTileState::~ManagedTileState() { |
| @@ -192,7 +197,7 @@ TileManager::~TileManager() { |
| void TileManager::SetGlobalState(const GlobalStateThatImpactsTilePriority& global_state) { |
| global_state_ = global_state; |
| resource_pool_->SetMaxMemoryUsageBytes(global_state_.memory_limit_in_bytes); |
| - ScheduleManageTiles(); |
| + ManageTiles(); |
|
ccameron
2012/12/26 23:55:54
Be sure to verify whether or not this change is ac
enne (OOO)
2012/12/27 22:06:39
This feels a little heavy handed. I think I would
ccameron
2012/12/27 22:42:59
Yes, this wasn't the right way to do it. I changed
enne (OOO)
2012/12/27 23:02:00
That sounds a lot better. :)
|
| } |
| void TileManager::RegisterTile(Tile* tile) { |
| @@ -286,6 +291,7 @@ void TileManager::ManageTiles() { |
| mts.resolution = prio.resolution; |
| mts.time_to_needed_in_seconds = prio.time_to_needed_in_seconds(); |
| mts.raster_bin = BinFromTilePriority(prio); |
| + mts.gpu_memmgr_stats_bin = BinFromTilePriority(tile->combined_priority()); |
|
ccameron
2012/12/26 23:55:54
I keep this bin around permanently so that we may
|
| } |
| // Memory limit policy works by mapping some bin states to the NEVER bin. |
| @@ -399,6 +405,26 @@ int TileManager::GetDrawableTilesInBinCount( |
| return drawable_tiles_in_bin_count_[bin][tree]; |
| } |
| +void TileManager::GetManagedMemoryStats( |
| + size_t* memoryVisibleBytes, |
| + size_t* memoryVisibleAndNearbyBytes, |
| + size_t* memoryAllocated) { |
| + *memoryVisibleBytes = 0; |
| + *memoryVisibleAndNearbyBytes = 0; |
| + *memoryAllocated = 0; |
| + for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { |
| + Tile* tile = *it; |
| + ManagedTileState& mts = tile->managed_state(); |
| + size_t tile_bytes = tile->bytes_consumed_if_allocated(); |
| + if (mts.gpu_memmgr_stats_bin == NOW_BIN) |
| + *memoryVisibleBytes += tile_bytes; |
| + if (mts.gpu_memmgr_stats_bin != NEVER_BIN) |
| + *memoryVisibleAndNearbyBytes += tile_bytes; |
| + if (mts.can_use_gpu_memory) |
| + *memoryAllocated += tile_bytes; |
| + } |
| +} |
| + |
| void TileManager::ResetBinCounts() { |
| for (int i = 0; i < NUM_BINS; ++i) |
| for (int j = 0; j < NUM_TREES; ++j) |