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

Unified Diff: cc/tile_manager.cc

Issue 11637022: Send memory management policies to the tile manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporate discussions Created 8 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 side-by-side diff with in-line comments
Download patch
« cc/managed_memory_policy.cc ('K') | « cc/tile_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« cc/managed_memory_policy.cc ('K') | « cc/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698