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

Unified Diff: cc/resources/tile_manager.cc

Issue 16959022: cc: Make tiles that are not required by trees NEVER_BIN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another test Created 7 years, 6 months 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
« no previous file with comments | « no previous file | cc/resources/tile_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/tile_manager.cc
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc
index 48cb31fe608f9c1efaf8c0f4799b393c6a330678..69b96bfd79d4df43d5d239ec66f71e54228e2d26 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -5,6 +5,7 @@
#include "cc/resources/tile_manager.h"
#include <algorithm>
+#include <limits>
#include <string>
#include "base/bind.h"
@@ -36,6 +37,10 @@ inline TileManagerBin BinFromTilePriority(const TilePriority& prio,
bool can_be_in_now_bin = tree_priority == SMOOTHNESS_TAKES_PRIORITY ||
prio.resolution != LOW_RESOLUTION;
+ if (prio.distance_to_visible_in_pixels ==
+ std::numeric_limits<float>::infinity())
+ return NEVER_BIN;
+
if (can_be_in_now_bin && prio.time_to_visible_in_seconds == 0)
return NOW_BIN;
@@ -512,9 +517,24 @@ void TileManager::AssignGpuMemoryToTiles() {
for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
Tile* tile = *it;
ManagedTileState& mts = tile->managed_state();
+ ManagedTileState::TileVersion& tile_version =
+ mts.tile_versions[mts.raster_mode];
if (mts.tree_bin[PENDING_TREE] == NEVER_BIN &&
mts.tree_bin[ACTIVE_TREE] != NOW_BIN) {
size_t bytes_that_can_be_freed = 0;
+
+ // If the tile is in the to-rasterize list, but it has no task,
+ // then it means that we have allocated memory for it.
reveman 2013/06/21 19:27:50 nit: that we have assigned memory to it?
vmpstr 2013/06/21 20:10:27 Done.
+ TileVector::iterator raster_it =
+ std::find(tiles_that_need_to_be_rasterized_.begin(),
+ tiles_that_need_to_be_rasterized_.end(),
+ tile);
+ if (raster_it != tiles_that_need_to_be_rasterized_.end() &&
+ tile_version.raster_task_.is_null()) {
+ bytes_that_can_be_freed += tile->bytes_consumed_if_allocated();
+ }
+
+ // Also consider all of the completed resources for freeing.
for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) {
ManagedTileState::TileVersion& tile_version =
mts.tile_versions[mode];
@@ -524,16 +544,13 @@ void TileManager::AssignGpuMemoryToTiles() {
}
}
+ // If we can free anything, then do so.
if (bytes_that_can_be_freed > 0) {
FreeResourcesForTile(tile);
bytes_freed += bytes_that_can_be_freed;
mts.tile_versions[mts.raster_mode].set_rasterize_on_demand();
- TileVector::iterator it = std::find(
- tiles_that_need_to_be_rasterized_.begin(),
- tiles_that_need_to_be_rasterized_.end(),
- tile);
- if (it != tiles_that_need_to_be_rasterized_.end())
- tiles_that_need_to_be_rasterized_.erase(it);
+ if (raster_it != tiles_that_need_to_be_rasterized_.end())
+ tiles_that_need_to_be_rasterized_.erase(raster_it);
}
}
« no previous file with comments | « no previous file | cc/resources/tile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698