Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: cc/resources/image_copy_raster_worker_pool.cc

Issue 454843002: cc: Do bitmap conversion for RasterBuffer in the worker thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code refactoring. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | cc/resources/pixel_buffer_raster_worker_pool.cc » ('j') | cc/resources/pixel_buffer_raster_worker_pool.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698