| 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_tile_task_worker_pool.h" | 5 #include "cc/resources/pixel_buffer_tile_task_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/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 } | 551 } |
| 552 | 552 |
| 553 // Update |bytes_pending_upload| now that task has cleared all | 553 // Update |bytes_pending_upload| now that task has cleared all |
| 554 // throttling limits. | 554 // throttling limits. |
| 555 bytes_pending_upload = new_bytes_pending_upload; | 555 bytes_pending_upload = new_bytes_pending_upload; |
| 556 | 556 |
| 557 DCHECK(state.type == RasterTaskState::UNSCHEDULED || | 557 DCHECK(state.type == RasterTaskState::UNSCHEDULED || |
| 558 state.type == RasterTaskState::SCHEDULED); | 558 state.type == RasterTaskState::SCHEDULED); |
| 559 state.type = RasterTaskState::SCHEDULED; | 559 state.type = RasterTaskState::SCHEDULED; |
| 560 | 560 |
| 561 InsertNodesForRasterTask(&graph_, task, task->dependencies(), priority++); | 561 InsertNodesForRasterTask(&graph_, task, task->dependencies(), priority++, |
| 562 kDefaultSubNamespace, kDefaultMaxConcurrentTasks); |
| 562 | 563 |
| 563 ++scheduled_raster_task_count; | 564 ++scheduled_raster_task_count; |
| 564 for (TaskSet task_set = 0; task_set < kNumberOfTaskSets; ++task_set) { | 565 for (TaskSet task_set = 0; task_set < kNumberOfTaskSets; ++task_set) { |
| 565 if (item.task_sets[task_set]) | 566 if (item.task_sets[task_set]) |
| 566 tasks[task_set].container().push_back(task); | 567 tasks[task_set].container().push_back(task); |
| 567 } | 568 } |
| 568 } | 569 } |
| 569 | 570 |
| 570 // Cancel existing OnTaskSetFinished callbacks. | 571 // Cancel existing OnTaskSetFinished callbacks. |
| 571 task_set_finished_weak_ptr_factory_.InvalidateWeakPtrs(); | 572 task_set_finished_weak_ptr_factory_.InvalidateWeakPtrs(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 582 if (!did_throttle_raster_tasks[task_set] && | 583 if (!did_throttle_raster_tasks[task_set] && |
| 583 should_notify_client_if_no_tasks_are_pending_[task_set]) { | 584 should_notify_client_if_no_tasks_are_pending_[task_set]) { |
| 584 new_task_set_finished_tasks[task_set] = CreateTaskSetFinishedTask( | 585 new_task_set_finished_tasks[task_set] = CreateTaskSetFinishedTask( |
| 585 task_runner_.get(), | 586 task_runner_.get(), |
| 586 base::Bind(&PixelBufferTileTaskWorkerPool::OnTaskSetFinished, | 587 base::Bind(&PixelBufferTileTaskWorkerPool::OnTaskSetFinished, |
| 587 task_set_finished_weak_ptr_factory_.GetWeakPtr(), | 588 task_set_finished_weak_ptr_factory_.GetWeakPtr(), |
| 588 task_set)); | 589 task_set)); |
| 589 task_set_finished_tasks_pending_[task_set] = true; | 590 task_set_finished_tasks_pending_[task_set] = true; |
| 590 InsertNodeForTask(&graph_, new_task_set_finished_tasks[task_set].get(), | 591 InsertNodeForTask(&graph_, new_task_set_finished_tasks[task_set].get(), |
| 591 kTaskSetFinishedTaskPriorityBase + task_set, | 592 kTaskSetFinishedTaskPriorityBase + task_set, |
| 592 scheduled_task_counts[task_set]); | 593 scheduled_task_counts[task_set], kDefaultSubNamespace, |
| 594 kDefaultMaxConcurrentTasks); |
| 593 for (RasterTaskVector::ContainerType::const_iterator it = | 595 for (RasterTaskVector::ContainerType::const_iterator it = |
| 594 tasks[task_set].container().begin(); | 596 tasks[task_set].container().begin(); |
| 595 it != tasks[task_set].container().end(); ++it) { | 597 it != tasks[task_set].container().end(); ++it) { |
| 596 graph_.edges.push_back( | 598 graph_.edges.push_back( |
| 597 TaskGraph::Edge(*it, new_task_set_finished_tasks[task_set].get())); | 599 TaskGraph::Edge(*it, new_task_set_finished_tasks[task_set].get())); |
| 598 } | 600 } |
| 599 } | 601 } |
| 600 } | 602 } |
| 601 | 603 |
| 602 DCHECK_LE(scheduled_raster_task_count, PendingRasterTaskCount()); | 604 DCHECK_LE(scheduled_raster_task_count, PendingRasterTaskCount()); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 void PixelBufferTileTaskWorkerPool::ThrottleStateAsValueInto( | 723 void PixelBufferTileTaskWorkerPool::ThrottleStateAsValueInto( |
| 722 base::trace_event::TracedValue* throttle_state) const { | 724 base::trace_event::TracedValue* throttle_state) const { |
| 723 throttle_state->SetInteger("bytes_available_for_upload", | 725 throttle_state->SetInteger("bytes_available_for_upload", |
| 724 max_bytes_pending_upload_ - bytes_pending_upload_); | 726 max_bytes_pending_upload_ - bytes_pending_upload_); |
| 725 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); | 727 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); |
| 726 throttle_state->SetInteger("scheduled_raster_task_count", | 728 throttle_state->SetInteger("scheduled_raster_task_count", |
| 727 scheduled_raster_task_count_); | 729 scheduled_raster_task_count_); |
| 728 } | 730 } |
| 729 | 731 |
| 730 } // namespace cc | 732 } // namespace cc |
| OLD | NEW |