Chromium Code Reviews| 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 "base/debug/trace_event_argument.h" | 10 #include "base/debug/trace_event_argument.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 184 void ImageCopyRasterWorkerPool::ReleaseBufferForRaster(RasterTask* task) { | 184 void ImageCopyRasterWorkerPool::ReleaseBufferForRaster(RasterTask* task) { |
| 185 RasterTaskState::Vector::iterator it = | 185 RasterTaskState::Vector::iterator it = |
| 186 std::find_if(raster_task_states_.begin(), | 186 std::find_if(raster_task_states_.begin(), |
| 187 raster_task_states_.end(), | 187 raster_task_states_.end(), |
| 188 RasterTaskState::TaskComparator(task)); | 188 RasterTaskState::TaskComparator(task)); |
| 189 DCHECK(it != raster_task_states_.end()); | 189 DCHECK(it != raster_task_states_.end()); |
| 190 scoped_ptr<ScopedResource> resource(it->resource); | 190 scoped_ptr<ScopedResource> resource(it->resource); |
| 191 std::swap(*it, raster_task_states_.back()); | 191 std::swap(*it, raster_task_states_.back()); |
| 192 raster_task_states_.pop_back(); | 192 raster_task_states_.pop_back(); |
| 193 | 193 |
| 194 bool content_has_changed = | 194 resource_provider_->ReleaseImageRasterBuffer(resource->id()); |
|
reveman
2014/08/13 19:19:49
Let's keep having this return true when contents m
auygun
2014/08/14 10:35:42
Done.
| |
| 195 resource_provider_->ReleaseImageRasterBuffer(resource->id()); | |
| 196 | 195 |
| 197 // |content_has_changed| can be false as result of task being canceled or | 196 // |content_has_changed| can be false as result of task being canceled or |
| 198 // task implementation deciding not to modify bitmap (ie. analysis of raster | 197 // task implementation deciding not to modify bitmap (ie. analysis of raster |
| 199 // commands detected content as a solid color). | 198 // commands detected content as a solid color). |
| 200 if (content_has_changed) { | 199 if (task->content_has_changed()) { |
| 201 resource_provider_->CopyResource(resource->id(), task->resource()->id()); | 200 resource_provider_->CopyResource(resource->id(), task->resource()->id()); |
| 202 has_performed_copy_since_last_flush_ = true; | 201 has_performed_copy_since_last_flush_ = true; |
| 203 } | 202 } |
| 204 | 203 |
| 205 resource_pool_->ReleaseResource(resource.Pass()); | 204 resource_pool_->ReleaseResource(resource.Pass()); |
| 206 } | 205 } |
| 207 | 206 |
| 208 void ImageCopyRasterWorkerPool::OnRasterFinished() { | 207 void ImageCopyRasterWorkerPool::OnRasterFinished() { |
| 209 TRACE_EVENT0("cc", "ImageCopyRasterWorkerPool::OnRasterFinished"); | 208 TRACE_EVENT0("cc", "ImageCopyRasterWorkerPool::OnRasterFinished"); |
| 210 | 209 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 255 resource_pool_->total_memory_usage_bytes()); | 254 resource_pool_->total_memory_usage_bytes()); |
| 256 staging_state->SetInteger("pending_copy_count", | 255 staging_state->SetInteger("pending_copy_count", |
| 257 resource_pool_->total_resource_count() - | 256 resource_pool_->total_resource_count() - |
| 258 resource_pool_->acquired_resource_count()); | 257 resource_pool_->acquired_resource_count()); |
| 259 staging_state->SetInteger("bytes_pending_copy", | 258 staging_state->SetInteger("bytes_pending_copy", |
| 260 resource_pool_->total_memory_usage_bytes() - | 259 resource_pool_->total_memory_usage_bytes() - |
| 261 resource_pool_->acquired_memory_usage_bytes()); | 260 resource_pool_->acquired_memory_usage_bytes()); |
| 262 } | 261 } |
| 263 | 262 |
| 264 } // namespace cc | 263 } // namespace cc |
| OLD | NEW |