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

Side by Side Diff: cc/tile_manager.cc

Issue 12223050: cc: Fix tile manager shutdown by aborting all pending uploads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« cc/resource_provider.cc ('K') | « cc/tile_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 137
138 TileManager::~TileManager() { 138 TileManager::~TileManager() {
139 // Reset global state and manage. This should cause 139 // Reset global state and manage. This should cause
140 // our memory usage to drop to zero. 140 // our memory usage to drop to zero.
141 global_state_ = GlobalStateThatImpactsTilePriority(); 141 global_state_ = GlobalStateThatImpactsTilePriority();
142 AssignGpuMemoryToTiles(); 142 AssignGpuMemoryToTiles();
143 // This should finish all pending tasks and release any uninitialized 143 // This should finish all pending tasks and release any uninitialized
144 // resources. 144 // resources.
145 raster_worker_pool_.reset(); 145 raster_worker_pool_.reset();
146 CheckForCompletedTileUploads(); 146 AbortPendingTileUploads();
147 DCHECK(tiles_with_pending_set_pixels_.size() == 0); 147 DCHECK(tiles_with_pending_set_pixels_.size() == 0);
148 DCHECK(tiles_.size() == 0); 148 DCHECK(tiles_.size() == 0);
149 } 149 }
150 150
151 void TileManager::SetGlobalState( 151 void TileManager::SetGlobalState(
152 const GlobalStateThatImpactsTilePriority& global_state) { 152 const GlobalStateThatImpactsTilePriority& global_state) {
153 global_state_ = global_state; 153 global_state_ = global_state;
154 resource_pool_->SetMaxMemoryUsageBytes(global_state_.memory_limit_in_bytes); 154 resource_pool_->SetMaxMemoryUsageBytes(global_state_.memory_limit_in_bytes);
155 ScheduleManageTiles(); 155 ScheduleManageTiles();
156 } 156 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 DidFinishTileInitialization(tile); 367 DidFinishTileInitialization(tile);
368 368
369 bytes_pending_set_pixels_ -= tile->bytes_consumed_if_allocated(); 369 bytes_pending_set_pixels_ -= tile->bytes_consumed_if_allocated();
370 DidTileRasterStateChange(tile, IDLE_STATE); 370 DidTileRasterStateChange(tile, IDLE_STATE);
371 tiles_with_pending_set_pixels_.pop(); 371 tiles_with_pending_set_pixels_.pop();
372 } 372 }
373 373
374 DispatchMoreTasks(); 374 DispatchMoreTasks();
375 } 375 }
376 376
377 void TileManager::AbortPendingTileUploads() {
378 while (!tiles_with_pending_set_pixels_.empty()) {
379 Tile* tile = tiles_with_pending_set_pixels_.front();
380 ManagedTileState& managed_tile_state = tile->managed_state();
381 DCHECK(managed_tile_state.resource);
382
383 resource_pool_->resource_provider()->abortSetPixels(
384 managed_tile_state.resource->id());
385 resource_pool_->resource_provider()->releasePixelBuffer(
386 managed_tile_state.resource->id());
387
388 managed_tile_state.resource_is_being_initialized = false;
389 managed_tile_state.can_be_freed = true;
390 managed_tile_state.can_use_gpu_memory = false;
391 FreeResourcesForTile(tile);
392
393 bytes_pending_set_pixels_ -= tile->bytes_consumed_if_allocated();
394 DidTileRasterStateChange(tile, IDLE_STATE);
395 tiles_with_pending_set_pixels_.pop();
396 }
397 }
398
377 void TileManager::GetMemoryStats( 399 void TileManager::GetMemoryStats(
378 size_t* memoryRequiredBytes, 400 size_t* memoryRequiredBytes,
379 size_t* memoryNiceToHaveBytes, 401 size_t* memoryNiceToHaveBytes,
380 size_t* memoryUsedBytes) const { 402 size_t* memoryUsedBytes) const {
381 *memoryRequiredBytes = 0; 403 *memoryRequiredBytes = 0;
382 *memoryNiceToHaveBytes = 0; 404 *memoryNiceToHaveBytes = 0;
383 *memoryUsedBytes = 0; 405 *memoryUsedBytes = 0;
384 for(size_t i = 0; i < tiles_.size(); i++) { 406 for(size_t i = 0; i < tiles_.size(); i++) {
385 const Tile* tile = tiles_[i]; 407 const Tile* tile = tiles_[i];
386 const ManagedTileState& mts = tile->managed_state(); 408 const ManagedTileState& mts = tile->managed_state();
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 decode_begin_time = base::TimeTicks::Now(); 900 decode_begin_time = base::TimeTicks::Now();
879 pixel_ref->Decode(); 901 pixel_ref->Decode();
880 if (stats) { 902 if (stats) {
881 stats->totalDeferredImageDecodeCount++; 903 stats->totalDeferredImageDecodeCount++;
882 stats->totalDeferredImageDecodeTime += 904 stats->totalDeferredImageDecodeTime +=
883 base::TimeTicks::Now() - decode_begin_time; 905 base::TimeTicks::Now() - decode_begin_time;
884 } 906 }
885 } 907 }
886 908
887 } // namespace cc 909 } // namespace cc
OLDNEW
« cc/resource_provider.cc ('K') | « cc/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698