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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/containers/stack_container.h" | 9 #include "base/containers/stack_container.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
508 RasterTaskState& state = *state_it; | 508 RasterTaskState& state = *state_it; |
509 | 509 |
510 // Skip task if completed. | 510 // Skip task if completed. |
511 if (state.type == RasterTaskState::COMPLETED) { | 511 if (state.type == RasterTaskState::COMPLETED) { |
512 DCHECK(std::find(completed_raster_tasks_.begin(), | 512 DCHECK(std::find(completed_raster_tasks_.begin(), |
513 completed_raster_tasks_.end(), | 513 completed_raster_tasks_.end(), |
514 task) != completed_raster_tasks_.end()); | 514 task) != completed_raster_tasks_.end()); |
515 continue; | 515 continue; |
516 } | 516 } |
517 | 517 |
518 // All raster tasks need to be throttled by bytes of pending uploads. | 518 // All raster tasks need to be throttled by bytes of pending uploads, |
519 // but if it's the first task allow it to complete no matter what its size, | |
reveman
2014/08/21 01:15:47
nit: maybe "only" instead of "first" as this is ef
enne (OOO)
2014/08/21 01:34:15
Done.
| |
520 // to prevent starvation of the task queue. | |
519 size_t new_bytes_pending_upload = bytes_pending_upload; | 521 size_t new_bytes_pending_upload = bytes_pending_upload; |
520 new_bytes_pending_upload += task->resource()->bytes(); | 522 new_bytes_pending_upload += task->resource()->bytes(); |
521 if (new_bytes_pending_upload > max_bytes_pending_upload_) { | 523 if (new_bytes_pending_upload > max_bytes_pending_upload_ && |
524 bytes_pending_upload > 0) { | |
reveman
2014/08/21 01:15:47
nit: s/bytes_pending_upload > 0/bytes_pending_uplo
enne (OOO)
2014/08/21 01:34:15
Done.
| |
522 did_throttle_raster_tasks = true; | 525 did_throttle_raster_tasks = true; |
523 if (item.required_for_activation) | 526 if (item.required_for_activation) |
524 did_throttle_raster_tasks_required_for_activation = true; | 527 did_throttle_raster_tasks_required_for_activation = true; |
525 continue; | 528 continue; |
526 } | 529 } |
527 | 530 |
528 // If raster has finished, just update |bytes_pending_upload|. | 531 // If raster has finished, just update |bytes_pending_upload|. |
529 if (state.type == RasterTaskState::UPLOADING) { | 532 if (state.type == RasterTaskState::UPLOADING) { |
530 DCHECK(!task->HasCompleted()); | 533 DCHECK(!task->HasCompleted()); |
531 bytes_pending_upload = new_bytes_pending_upload; | 534 bytes_pending_upload = new_bytes_pending_upload; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
752 void PixelBufferRasterWorkerPool::ThrottleStateAsValueInto( | 755 void PixelBufferRasterWorkerPool::ThrottleStateAsValueInto( |
753 base::debug::TracedValue* throttle_state) const { | 756 base::debug::TracedValue* throttle_state) const { |
754 throttle_state->SetInteger("bytes_available_for_upload", | 757 throttle_state->SetInteger("bytes_available_for_upload", |
755 max_bytes_pending_upload_ - bytes_pending_upload_); | 758 max_bytes_pending_upload_ - bytes_pending_upload_); |
756 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); | 759 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); |
757 throttle_state->SetInteger("scheduled_raster_task_count", | 760 throttle_state->SetInteger("scheduled_raster_task_count", |
758 scheduled_raster_task_count_); | 761 scheduled_raster_task_count_); |
759 } | 762 } |
760 | 763 |
761 } // namespace cc | 764 } // namespace cc |
OLD | NEW |