Chromium Code Reviews| 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/containers/stack_container.h" | 7 #include "base/containers/stack_container.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "cc/debug/traced_value.h" | 10 #include "cc/debug/traced_value.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 | 84 |
| 85 // Only used as std::find_if predicate for DCHECKs. | 85 // Only used as std::find_if predicate for DCHECKs. |
| 86 bool WasCanceled(const internal::RasterWorkerPoolTask* task) { | 86 bool WasCanceled(const internal::RasterWorkerPoolTask* task) { |
| 87 return task->WasCanceled(); | 87 return task->WasCanceled(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace | 90 } // namespace |
| 91 | 91 |
| 92 PixelBufferRasterWorkerPool::PixelBufferRasterWorkerPool( | 92 PixelBufferRasterWorkerPool::PixelBufferRasterWorkerPool( |
| 93 ResourceProvider* resource_provider, | 93 ResourceProvider* resource_provider, |
| 94 ContextProvider* context_provider, | |
| 94 size_t num_threads, | 95 size_t num_threads, |
| 95 size_t max_transfer_buffer_usage_bytes) | 96 size_t max_transfer_buffer_usage_bytes) |
| 96 : RasterWorkerPool(resource_provider, num_threads), | 97 : RasterWorkerPool(resource_provider, context_provider, num_threads), |
| 97 shutdown_(false), | 98 shutdown_(false), |
| 98 scheduled_raster_task_count_(0), | 99 scheduled_raster_task_count_(0), |
| 99 bytes_pending_upload_(0), | 100 bytes_pending_upload_(0), |
| 100 max_bytes_pending_upload_(max_transfer_buffer_usage_bytes), | 101 max_bytes_pending_upload_(max_transfer_buffer_usage_bytes), |
| 101 has_performed_uploads_since_last_flush_(false), | 102 has_performed_uploads_since_last_flush_(false), |
| 102 check_for_completed_raster_tasks_pending_(false), | 103 check_for_completed_raster_tasks_pending_(false), |
| 103 should_notify_client_if_no_tasks_are_pending_(false), | 104 should_notify_client_if_no_tasks_are_pending_(false), |
| 104 should_notify_client_if_no_tasks_required_for_activation_are_pending_( | 105 should_notify_client_if_no_tasks_required_for_activation_are_pending_( |
| 105 false) { | 106 false) { |
| 106 } | 107 } |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 130 task->DidRun(true); | 131 task->DidRun(true); |
| 131 completed_tasks_.push_back(task); | 132 completed_tasks_.push_back(task); |
| 132 } | 133 } |
| 133 } | 134 } |
| 134 DCHECK_EQ(completed_tasks_.size(), pixel_buffer_tasks_.size()); | 135 DCHECK_EQ(completed_tasks_.size(), pixel_buffer_tasks_.size()); |
| 135 } | 136 } |
| 136 | 137 |
| 137 void PixelBufferRasterWorkerPool::ScheduleTasks(RasterTask::Queue* queue) { | 138 void PixelBufferRasterWorkerPool::ScheduleTasks(RasterTask::Queue* queue) { |
| 138 TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::ScheduleTasks"); | 139 TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::ScheduleTasks"); |
| 139 | 140 |
| 141 RasterWorkerPool::CompleteOriginThreadTasks(queue); | |
|
reveman
2013/12/17 00:28:48
Should we call this after ScheduleCheckForComplete
alokp
2013/12/17 22:12:15
Done.
| |
| 140 RasterWorkerPool::SetRasterTasks(queue); | 142 RasterWorkerPool::SetRasterTasks(queue); |
| 141 | 143 |
| 142 if (!should_notify_client_if_no_tasks_are_pending_) | 144 if (!should_notify_client_if_no_tasks_are_pending_) |
| 143 TRACE_EVENT_ASYNC_BEGIN0("cc", "ScheduledTasks", this); | 145 TRACE_EVENT_ASYNC_BEGIN0("cc", "ScheduledTasks", this); |
| 144 | 146 |
| 145 should_notify_client_if_no_tasks_are_pending_ = true; | 147 should_notify_client_if_no_tasks_are_pending_ = true; |
| 146 should_notify_client_if_no_tasks_required_for_activation_are_pending_ = true; | 148 should_notify_client_if_no_tasks_required_for_activation_are_pending_ = true; |
| 147 | 149 |
| 148 tasks_required_for_activation_.clear(); | 150 tasks_required_for_activation_.clear(); |
| 149 | 151 |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 668 | 670 |
| 669 throttle_state->SetInteger("bytes_available_for_upload", | 671 throttle_state->SetInteger("bytes_available_for_upload", |
| 670 max_bytes_pending_upload_ - bytes_pending_upload_); | 672 max_bytes_pending_upload_ - bytes_pending_upload_); |
| 671 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); | 673 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); |
| 672 throttle_state->SetInteger("scheduled_raster_task_count", | 674 throttle_state->SetInteger("scheduled_raster_task_count", |
| 673 scheduled_raster_task_count_); | 675 scheduled_raster_task_count_); |
| 674 return throttle_state.PassAs<base::Value>(); | 676 return throttle_state.PassAs<base::Value>(); |
| 675 } | 677 } |
| 676 | 678 |
| 677 } // namespace cc | 679 } // namespace cc |
| OLD | NEW |