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

Unified Diff: cc/tile_manager.cc

Issue 11557017: cc: Reduce time spent in AssignGpuMemoryToTiles(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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
« no previous file with comments | « 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 f3921df7903764ed3ce93d7f4e3c0aa379dc8554..1f348716a120ee56051de42709eaf863acb7444c 100644
--- a/cc/tile_manager.cc
+++ b/cc/tile_manager.cc
@@ -134,6 +134,7 @@ TileManager::TileManager(
resource_pool_(ResourcePool::Create(resource_provider,
Renderer::ImplPool)),
manage_tiles_pending_(false),
+ manage_tiles_call_count_(0),
check_for_completed_set_pixels_pending_(false) {
// Initialize all threads.
const std::string thread_name_prefix = kRasterThreadNamePrefix;
@@ -234,6 +235,7 @@ public:
void TileManager::ManageTiles() {
TRACE_EVENT0("cc", "TileManager::ManageTiles");
manage_tiles_pending_ = false;
+ ++manage_tiles_call_count_;
// The amount of time for which we want to have prepainting coverage.
const double prepainting_window_time_seconds = 1.0;
@@ -562,6 +564,7 @@ void TileManager::DispatchOneRasterTask(
tile,
base::Passed(&resource),
picture_pile_clone,
+ manage_tiles_call_count_,
stats));
}
@@ -569,6 +572,7 @@ void TileManager::OnRasterTaskCompleted(
scoped_refptr<Tile> tile,
scoped_ptr<ResourcePool::Resource> resource,
scoped_refptr<PicturePileImpl> picture_pile_clone,
+ int manage_tiles_call_count_when_dispatched,
RenderingStats* stats) {
TRACE_EVENT0("cc", "TileManager::OnRasterTaskCompleted");
rendering_stats_.totalRasterizeTimeInSeconds +=
@@ -584,11 +588,12 @@ void TileManager::OnRasterTaskCompleted(
// Tile can be freed after the completion of the raster task. Call
// AssignGpuMemoryToTiles() to re-assign gpu memory to highest priority
- // tiles. The result of this could be that this tile is no longer
- // allowed to use gpu memory and in that case we need to abort
- // initialization and free all associated resources before calling
- // DispatchMoreTasks().
- AssignGpuMemoryToTiles();
+ // tiles if ManageTiles() was called since task was dispatched. The result
+ // of this could be that this tile is no longer allowed to use gpu
+ // memory and in that case we need to abort initialization and free all
+ // associated resources before calling DispatchMoreTasks().
+ if (manage_tiles_call_count_when_dispatched != manage_tiles_call_count_)
+ AssignGpuMemoryToTiles();
// Finish resource initialization if |can_use_gpu_memory| is true.
if (managed_tile_state.can_use_gpu_memory) {
« no previous file with comments | « cc/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698