OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/resources/pixel_buffer_raster_worker_pool.h" | 5 #include "cc/resources/pixel_buffer_raster_worker_pool.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "cc/resources/resource.h" | 8 #include "cc/resources/resource.h" |
9 #include "third_party/skia/include/core/SkDevice.h" | 9 #include "third_party/skia/include/core/SkDevice.h" |
10 | 10 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 } | 222 } |
223 | 223 |
224 DCHECK(client()); | 224 DCHECK(client()); |
225 bool should_force_some_uploads_to_complete = | 225 bool should_force_some_uploads_to_complete = |
226 shutdown_ || client()->ShouldForceTasksRequiredForActivationToComplete(); | 226 shutdown_ || client()->ShouldForceTasksRequiredForActivationToComplete(); |
227 | 227 |
228 if (should_force_some_uploads_to_complete) { | 228 if (should_force_some_uploads_to_complete) { |
229 TaskDeque tasks_with_uploads_to_force; | 229 TaskDeque tasks_with_uploads_to_force; |
230 TaskDeque::iterator it = tasks_with_pending_upload_.begin(); | 230 TaskDeque::iterator it = tasks_with_pending_upload_.begin(); |
231 while (it != tasks_with_pending_upload_.end()) { | 231 while (it != tasks_with_pending_upload_.end()) { |
232 internal::RasterWorkerPoolTask* task = *it; | 232 internal::RasterWorkerPoolTask* task = it->get(); |
233 DCHECK(pixel_buffer_tasks_.find(task) != pixel_buffer_tasks_.end()); | 233 DCHECK(pixel_buffer_tasks_.find(task) != pixel_buffer_tasks_.end()); |
234 | 234 |
235 // Force all uploads required for activation to complete. | 235 // Force all uploads required for activation to complete. |
236 // During shutdown, force all pending uploads to complete. | 236 // During shutdown, force all pending uploads to complete. |
237 if (shutdown_ || IsRasterTaskRequiredForActivation(task)) { | 237 if (shutdown_ || IsRasterTaskRequiredForActivation(task)) { |
238 tasks_with_uploads_to_force.push_back(task); | 238 tasks_with_uploads_to_force.push_back(task); |
239 tasks_with_completed_uploads.push_back(task); | 239 tasks_with_completed_uploads.push_back(task); |
240 it = tasks_with_pending_upload_.erase(it); | 240 it = tasks_with_pending_upload_.erase(it); |
241 continue; | 241 continue; |
242 } | 242 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 task) != completed_tasks_.end()); | 332 task) != completed_tasks_.end()); |
333 continue; | 333 continue; |
334 } | 334 } |
335 | 335 |
336 // All raster tasks need to be throttled by bytes of pending uploads. | 336 // All raster tasks need to be throttled by bytes of pending uploads. |
337 size_t new_bytes_pending_upload = bytes_pending_upload; | 337 size_t new_bytes_pending_upload = bytes_pending_upload; |
338 new_bytes_pending_upload += task->resource()->bytes(); | 338 new_bytes_pending_upload += task->resource()->bytes(); |
339 if (new_bytes_pending_upload > kMaxPendingUploadBytes) | 339 if (new_bytes_pending_upload > kMaxPendingUploadBytes) |
340 break; | 340 break; |
341 | 341 |
342 internal::WorkerPoolTask* pixel_buffer_task = pixel_buffer_it->second; | 342 internal::WorkerPoolTask* pixel_buffer_task = pixel_buffer_it->second.get(); |
343 | 343 |
344 // If raster has finished, just update |bytes_pending_upload|. | 344 // If raster has finished, just update |bytes_pending_upload|. |
345 if (pixel_buffer_task && pixel_buffer_task->HasCompleted()) { | 345 if (pixel_buffer_task && pixel_buffer_task->HasCompleted()) { |
346 bytes_pending_upload = new_bytes_pending_upload; | 346 bytes_pending_upload = new_bytes_pending_upload; |
347 continue; | 347 continue; |
348 } | 348 } |
349 | 349 |
350 // Throttle raster tasks based on bytes pending if raster has not | 350 // Throttle raster tasks based on bytes pending if raster has not |
351 // finished. | 351 // finished. |
352 size_t new_bytes_pending_raster = bytes_pending_raster; | 352 size_t new_bytes_pending_raster = bytes_pending_raster; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 } | 418 } |
419 | 419 |
420 resource_provider()->BeginSetPixels(task->resource()->id()); | 420 resource_provider()->BeginSetPixels(task->resource()->id()); |
421 has_performed_uploads_since_last_flush_ = true; | 421 has_performed_uploads_since_last_flush_ = true; |
422 | 422 |
423 bytes_pending_upload_ += task->resource()->bytes(); | 423 bytes_pending_upload_ += task->resource()->bytes(); |
424 tasks_with_pending_upload_.push_back(task); | 424 tasks_with_pending_upload_.push_back(task); |
425 } | 425 } |
426 | 426 |
427 } // namespace cc | 427 } // namespace cc |
OLD | NEW |