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

Side by Side Diff: cc/resources/pixel_buffer_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: Changed RasterBuffer interface. 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 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/containers/stack_container.h" 9 #include "base/containers/stack_container.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 DCHECK_EQ(RasterTaskState::COMPLETED, state_it->type); 254 DCHECK_EQ(RasterTaskState::COMPLETED, state_it->type);
255 255
256 std::swap(*state_it, raster_task_states_.back()); 256 std::swap(*state_it, raster_task_states_.back());
257 raster_task_states_.pop_back(); 257 raster_task_states_.pop_back();
258 258
259 task->RunReplyOnOriginThread(); 259 task->RunReplyOnOriginThread();
260 } 260 }
261 completed_raster_tasks_.clear(); 261 completed_raster_tasks_.clear();
262 } 262 }
263 263
264 SkCanvas* PixelBufferRasterWorkerPool::AcquireCanvasForRaster( 264 RasterBuffer* PixelBufferRasterWorkerPool::AcquireBufferForRaster(
265 RasterTask* task) { 265 RasterTask* task) {
266 DCHECK(std::find_if(raster_task_states_.begin(), 266 DCHECK(std::find_if(raster_task_states_.begin(),
267 raster_task_states_.end(), 267 raster_task_states_.end(),
268 RasterTaskState::TaskComparator(task)) != 268 RasterTaskState::TaskComparator(task)) !=
269 raster_task_states_.end()); 269 raster_task_states_.end());
270 resource_provider_->AcquirePixelRasterBuffer(task->resource()->id()); 270 resource_provider_->AcquirePixelRasterBuffer(task->resource()->id());
271 return resource_provider_->MapPixelRasterBuffer(task->resource()->id()); 271 return resource_provider_->MapPixelRasterBuffer(task->resource()->id());
272 } 272 }
273 273
274 void PixelBufferRasterWorkerPool::ReleaseCanvasForRaster(RasterTask* task) { 274 void PixelBufferRasterWorkerPool::ReleaseBufferForRaster(RasterTask* task) {
275 DCHECK(std::find_if(raster_task_states_.begin(), 275 DCHECK(std::find_if(raster_task_states_.begin(),
276 raster_task_states_.end(), 276 raster_task_states_.end(),
277 RasterTaskState::TaskComparator(task)) != 277 RasterTaskState::TaskComparator(task)) !=
278 raster_task_states_.end()); 278 raster_task_states_.end());
279 resource_provider_->ReleasePixelRasterBuffer(task->resource()->id()); 279 resource_provider_->ReleasePixelRasterBuffer(task->resource()->id());
280 } 280 }
281 281
282 void PixelBufferRasterWorkerPool::OnRasterFinished() { 282 void PixelBufferRasterWorkerPool::OnRasterFinished() {
283 TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::OnRasterFinished"); 283 TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::OnRasterFinished");
284 284
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 676
677 RasterTaskState::Vector::iterator state_it = 677 RasterTaskState::Vector::iterator state_it =
678 std::find_if(raster_task_states_.begin(), 678 std::find_if(raster_task_states_.begin(),
679 raster_task_states_.end(), 679 raster_task_states_.end(),
680 RasterTaskState::TaskComparator(raster_task)); 680 RasterTaskState::TaskComparator(raster_task));
681 DCHECK(state_it != raster_task_states_.end()); 681 DCHECK(state_it != raster_task_states_.end());
682 682
683 RasterTaskState& state = *state_it; 683 RasterTaskState& state = *state_it;
684 DCHECK_EQ(RasterTaskState::SCHEDULED, state.type); 684 DCHECK_EQ(RasterTaskState::SCHEDULED, state.type);
685 685
686 // Balanced with MapPixelRasterBuffer() call in AcquireCanvasForRaster(). 686 // Balanced with MapPixelRasterBuffer() call in AcquireBufferForRaster().
687 bool content_has_changed = resource_provider_->UnmapPixelRasterBuffer( 687 bool content_has_changed = resource_provider_->UnmapPixelRasterBuffer(
688 raster_task->resource()->id()); 688 raster_task->resource()->id());
689 689
690 // |content_has_changed| can be false as result of task being canceled or 690 // |content_has_changed| can be false as result of task being canceled or
691 // task implementation deciding not to modify bitmap (ie. analysis of raster 691 // task implementation deciding not to modify bitmap (ie. analysis of raster
692 // commands detected content as a solid color). 692 // commands detected content as a solid color).
693 if (!content_has_changed) { 693 if (!content_has_changed) {
694 raster_task->WillComplete(); 694 raster_task->WillComplete();
695 raster_task->CompleteOnOriginThread(this); 695 raster_task->CompleteOnOriginThread(this);
696 raster_task->DidComplete(); 696 raster_task->DidComplete();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 void PixelBufferRasterWorkerPool::ThrottleStateAsValueInto( 752 void PixelBufferRasterWorkerPool::ThrottleStateAsValueInto(
753 base::debug::TracedValue* throttle_state) const { 753 base::debug::TracedValue* throttle_state) const {
754 throttle_state->SetInteger("bytes_available_for_upload", 754 throttle_state->SetInteger("bytes_available_for_upload",
755 max_bytes_pending_upload_ - bytes_pending_upload_); 755 max_bytes_pending_upload_ - bytes_pending_upload_);
756 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); 756 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_);
757 throttle_state->SetInteger("scheduled_raster_task_count", 757 throttle_state->SetInteger("scheduled_raster_task_count",
758 scheduled_raster_task_count_); 758 scheduled_raster_task_count_);
759 } 759 }
760 760
761 } // namespace cc 761 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698