| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/image_copy_raster_worker_pool.h" | 5 #include "cc/resources/image_copy_raster_worker_pool.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "cc/debug/traced_value.h" | 10 #include "base/debug/traced_value.h" |
| 11 #include "cc/resources/resource_pool.h" | 11 #include "cc/resources/resource_pool.h" |
| 12 #include "cc/resources/scoped_resource.h" | 12 #include "cc/resources/scoped_resource.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 // static | 16 // static |
| 17 scoped_ptr<RasterWorkerPool> ImageCopyRasterWorkerPool::Create( | 17 scoped_ptr<RasterWorkerPool> ImageCopyRasterWorkerPool::Create( |
| 18 base::SequencedTaskRunner* task_runner, | 18 base::SequencedTaskRunner* task_runner, |
| 19 TaskGraphRunner* task_graph_runner, | 19 TaskGraphRunner* task_graph_runner, |
| 20 ResourceProvider* resource_provider, | 20 ResourceProvider* resource_provider, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 new_raster_required_for_activation_finished_task; | 129 new_raster_required_for_activation_finished_task; |
| 130 | 130 |
| 131 resource_pool_->ReduceResourceUsage(); | 131 resource_pool_->ReduceResourceUsage(); |
| 132 | 132 |
| 133 TRACE_EVENT_ASYNC_STEP_INTO1( | 133 TRACE_EVENT_ASYNC_STEP_INTO1( |
| 134 "cc", | 134 "cc", |
| 135 "ScheduledTasks", | 135 "ScheduledTasks", |
| 136 this, | 136 this, |
| 137 "rasterizing", | 137 "rasterizing", |
| 138 "state", | 138 "state", |
| 139 TracedValue::FromValue(StateAsValue().release())); | 139 base::debug::TracedValue::FromValue(StateAsValue().release())); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void ImageCopyRasterWorkerPool::CheckForCompletedTasks() { | 142 void ImageCopyRasterWorkerPool::CheckForCompletedTasks() { |
| 143 TRACE_EVENT0("cc", "ImageCopyRasterWorkerPool::CheckForCompletedTasks"); | 143 TRACE_EVENT0("cc", "ImageCopyRasterWorkerPool::CheckForCompletedTasks"); |
| 144 | 144 |
| 145 task_graph_runner_->CollectCompletedTasks(namespace_token_, | 145 task_graph_runner_->CollectCompletedTasks(namespace_token_, |
| 146 &completed_tasks_); | 146 &completed_tasks_); |
| 147 for (Task::Vector::const_iterator it = completed_tasks_.begin(); | 147 for (Task::Vector::const_iterator it = completed_tasks_.begin(); |
| 148 it != completed_tasks_.end(); | 148 it != completed_tasks_.end(); |
| 149 ++it) { | 149 ++it) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 "cc", "ImageCopyRasterWorkerPool::OnRasterRequiredForActivationFinished"); | 211 "cc", "ImageCopyRasterWorkerPool::OnRasterRequiredForActivationFinished"); |
| 212 | 212 |
| 213 DCHECK(raster_tasks_required_for_activation_pending_); | 213 DCHECK(raster_tasks_required_for_activation_pending_); |
| 214 raster_tasks_required_for_activation_pending_ = false; | 214 raster_tasks_required_for_activation_pending_ = false; |
| 215 TRACE_EVENT_ASYNC_STEP_INTO1( | 215 TRACE_EVENT_ASYNC_STEP_INTO1( |
| 216 "cc", | 216 "cc", |
| 217 "ScheduledTasks", | 217 "ScheduledTasks", |
| 218 this, | 218 this, |
| 219 "rasterizing", | 219 "rasterizing", |
| 220 "state", | 220 "state", |
| 221 TracedValue::FromValue(StateAsValue().release())); | 221 base::debug::TracedValue::FromValue(StateAsValue().release())); |
| 222 client_->DidFinishRunningTasksRequiredForActivation(); | 222 client_->DidFinishRunningTasksRequiredForActivation(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void ImageCopyRasterWorkerPool::FlushCopies() { | 225 void ImageCopyRasterWorkerPool::FlushCopies() { |
| 226 if (!has_performed_copy_since_last_flush_) | 226 if (!has_performed_copy_since_last_flush_) |
| 227 return; | 227 return; |
| 228 | 228 |
| 229 resource_provider_->ShallowFlushIfSupported(); | 229 resource_provider_->ShallowFlushIfSupported(); |
| 230 has_performed_copy_since_last_flush_ = false; | 230 has_performed_copy_since_last_flush_ = false; |
| 231 } | 231 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 251 resource_pool_->total_resource_count() - | 251 resource_pool_->total_resource_count() - |
| 252 resource_pool_->acquired_resource_count()); | 252 resource_pool_->acquired_resource_count()); |
| 253 staging_state->SetInteger("bytes_pending_copy", | 253 staging_state->SetInteger("bytes_pending_copy", |
| 254 resource_pool_->total_memory_usage_bytes() - | 254 resource_pool_->total_memory_usage_bytes() - |
| 255 resource_pool_->acquired_memory_usage_bytes()); | 255 resource_pool_->acquired_memory_usage_bytes()); |
| 256 | 256 |
| 257 return staging_state.PassAs<base::Value>(); | 257 return staging_state.PassAs<base::Value>(); |
| 258 } | 258 } |
| 259 | 259 |
| 260 } // namespace cc | 260 } // namespace cc |
| OLD | NEW |