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

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
« no previous file with comments | « 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 136
137 TileManager::~TileManager() { 137 TileManager::~TileManager() {
138 // Reset global state and manage. This should cause 138 // Reset global state and manage. This should cause
139 // our memory usage to drop to zero. 139 // our memory usage to drop to zero.
140 global_state_ = GlobalStateThatImpactsTilePriority(); 140 global_state_ = GlobalStateThatImpactsTilePriority();
141 AssignGpuMemoryToTiles(); 141 AssignGpuMemoryToTiles();
142 // This should finish all pending tasks and release any uninitialized 142 // This should finish all pending tasks and release any uninitialized
143 // resources. 143 // resources.
144 raster_worker_pool_.reset(); 144 raster_worker_pool_.reset();
145 CheckForCompletedTileUploads(); 145 AbortPendingTileUploads();
146 DCHECK(tiles_with_pending_set_pixels_.size() == 0); 146 DCHECK(tiles_with_pending_set_pixels_.size() == 0);
147 DCHECK(tiles_.size() == 0); 147 DCHECK(tiles_.size() == 0);
148 } 148 }
149 149
150 void TileManager::SetGlobalState( 150 void TileManager::SetGlobalState(
151 const GlobalStateThatImpactsTilePriority& global_state) { 151 const GlobalStateThatImpactsTilePriority& global_state) {
152 global_state_ = global_state; 152 global_state_ = global_state;
153 resource_pool_->SetMaxMemoryUsageBytes(global_state_.memory_limit_in_bytes); 153 resource_pool_->SetMaxMemoryUsageBytes(global_state_.memory_limit_in_bytes);
154 ScheduleManageTiles(); 154 ScheduleManageTiles();
155 } 155 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 DidFinishTileInitialization(tile); 366 DidFinishTileInitialization(tile);
367 367
368 bytes_pending_set_pixels_ -= tile->bytes_consumed_if_allocated(); 368 bytes_pending_set_pixels_ -= tile->bytes_consumed_if_allocated();
369 DidTileRasterStateChange(tile, IDLE_STATE); 369 DidTileRasterStateChange(tile, IDLE_STATE);
370 tiles_with_pending_set_pixels_.pop(); 370 tiles_with_pending_set_pixels_.pop();
371 } 371 }
372 372
373 DispatchMoreTasks(); 373 DispatchMoreTasks();
374 } 374 }
375 375
376 void TileManager::AbortPendingTileUploads() {
377 while (!tiles_with_pending_set_pixels_.empty()) {
378 Tile* tile = tiles_with_pending_set_pixels_.front();
379 ManagedTileState& managed_tile_state = tile->managed_state();
380 DCHECK(managed_tile_state.resource);
381
382 resource_pool_->resource_provider()->abortSetPixels(
383 managed_tile_state.resource->id());
384 resource_pool_->resource_provider()->releasePixelBuffer(
385 managed_tile_state.resource->id());
386
387 managed_tile_state.resource_is_being_initialized = false;
388 managed_tile_state.can_be_freed = true;
389 managed_tile_state.can_use_gpu_memory = false;
390 FreeResourcesForTile(tile);
391
392 bytes_pending_set_pixels_ -= tile->bytes_consumed_if_allocated();
393 DidTileRasterStateChange(tile, IDLE_STATE);
394 tiles_with_pending_set_pixels_.pop();
395 }
396 }
397
376 void TileManager::GetMemoryStats( 398 void TileManager::GetMemoryStats(
377 size_t* memoryRequiredBytes, 399 size_t* memoryRequiredBytes,
378 size_t* memoryNiceToHaveBytes, 400 size_t* memoryNiceToHaveBytes,
379 size_t* memoryUsedBytes) const { 401 size_t* memoryUsedBytes) const {
380 *memoryRequiredBytes = 0; 402 *memoryRequiredBytes = 0;
381 *memoryNiceToHaveBytes = 0; 403 *memoryNiceToHaveBytes = 0;
382 *memoryUsedBytes = 0; 404 *memoryUsedBytes = 0;
383 for(size_t i = 0; i < tiles_.size(); i++) { 405 for(size_t i = 0; i < tiles_.size(); i++) {
384 const Tile* tile = tiles_[i]; 406 const Tile* tile = tiles_[i];
385 const ManagedTileState& mts = tile->managed_state(); 407 const ManagedTileState& mts = tile->managed_state();
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 decode_begin_time = base::TimeTicks::Now(); 907 decode_begin_time = base::TimeTicks::Now();
886 pixel_ref->Decode(); 908 pixel_ref->Decode();
887 if (stats) { 909 if (stats) {
888 stats->totalDeferredImageDecodeCount++; 910 stats->totalDeferredImageDecodeCount++;
889 stats->totalDeferredImageDecodeTime += 911 stats->totalDeferredImageDecodeTime +=
890 base::TimeTicks::Now() - decode_begin_time; 912 base::TimeTicks::Now() - decode_begin_time;
891 } 913 }
892 } 914 }
893 915
894 } // namespace cc 916 } // namespace cc
OLDNEW
« 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