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

Unified Diff: cc/raster/pixel_buffer_tile_task_worker_pool.cc

Issue 1154393003: cc: Use CheckedNumeric for resource size calculations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: initialize var Created 5 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 | « cc/cc.gyp ('k') | cc/raster/tile_task_worker_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/raster/pixel_buffer_tile_task_worker_pool.cc
diff --git a/cc/raster/pixel_buffer_tile_task_worker_pool.cc b/cc/raster/pixel_buffer_tile_task_worker_pool.cc
index 633a8746cb1e64657daf9ebf579316f0448741d4..0132fe0963e2dbfb6afd5991f68c201e28e1949c 100644
--- a/cc/raster/pixel_buffer_tile_task_worker_pool.cc
+++ b/cc/raster/pixel_buffer_tile_task_worker_pool.cc
@@ -431,7 +431,10 @@ void PixelBufferTileTaskWorkerPool::CheckForCompletedUploads() {
DCHECK(state_it != raster_task_states_.end());
RasterTaskState& state = *state_it;
- bytes_pending_upload_ -= task->resource()->bytes();
+ // We can use UncheckedMemorySizeBytes here, since these tasks come from
+ // tiles, the size of which is controlled by the compositor.
+ bytes_pending_upload_ -= Resource::UncheckedMemorySizeBytes(
+ task->resource()->size(), task->resource()->format());
task->WillComplete();
task->CompleteOnOriginThread(this);
@@ -537,7 +540,10 @@ void PixelBufferTileTaskWorkerPool::ScheduleMoreTasks() {
// but if it's the only task allow it to complete no matter what its size,
// to prevent starvation of the task queue.
size_t new_bytes_pending_upload = bytes_pending_upload;
- new_bytes_pending_upload += task->resource()->bytes();
+ // We can use UncheckedMemorySizeBytes here, since these tasks come from
+ // tiles, the size of which is controlled by the compositor.
+ new_bytes_pending_upload += Resource::UncheckedMemorySizeBytes(
+ task->resource()->size(), task->resource()->format());
if (new_bytes_pending_upload > max_bytes_pending_upload_ &&
bytes_pending_upload) {
did_throttle_raster_tasks |= item.task_sets;
@@ -701,7 +707,10 @@ void PixelBufferTileTaskWorkerPool::CheckForCompletedRasterizerTasks() {
resource_provider_->BeginSetPixels(raster_task->resource()->id());
has_performed_uploads_since_last_flush_ = true;
- bytes_pending_upload_ += raster_task->resource()->bytes();
+ // We can use UncheckedMemorySizeBytes here, since these tasks come from
+ // tiles, the size of which is controlled by the compositor.
+ bytes_pending_upload_ += Resource::UncheckedMemorySizeBytes(
+ raster_task->resource()->size(), raster_task->resource()->format());
raster_tasks_with_pending_upload_.push_back(raster_task);
state.type = RasterTaskState::UPLOADING;
}
« no previous file with comments | « cc/cc.gyp ('k') | cc/raster/tile_task_worker_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698