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

Unified 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: Fix and cleanup. 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 side-by-side diff with in-line comments
Download patch
Index: cc/resources/pixel_buffer_raster_worker_pool.cc
diff --git a/cc/resources/pixel_buffer_raster_worker_pool.cc b/cc/resources/pixel_buffer_raster_worker_pool.cc
index d7554736942a66ee541c065c99320385c42d0234..21c81644216a963e7185023a93b4fde9219ccef0 100644
--- a/cc/resources/pixel_buffer_raster_worker_pool.cc
+++ b/cc/resources/pixel_buffer_raster_worker_pool.cc
@@ -261,17 +261,16 @@ void PixelBufferRasterWorkerPool::CheckForCompletedTasks() {
completed_raster_tasks_.clear();
}
-SkCanvas* PixelBufferRasterWorkerPool::AcquireCanvasForRaster(
+RasterBuffer* PixelBufferRasterWorkerPool::AcquireBufferForRaster(
RasterTask* task) {
DCHECK(std::find_if(raster_task_states_.begin(),
raster_task_states_.end(),
RasterTaskState::TaskComparator(task)) !=
raster_task_states_.end());
- resource_provider_->AcquirePixelRasterBuffer(task->resource()->id());
- return resource_provider_->MapPixelRasterBuffer(task->resource()->id());
+ return resource_provider_->AcquirePixelRasterBuffer(task->resource()->id());
}
-void PixelBufferRasterWorkerPool::ReleaseCanvasForRaster(RasterTask* task) {
+void PixelBufferRasterWorkerPool::ReleaseBufferForRaster(RasterTask* task) {
DCHECK(std::find_if(raster_task_states_.begin(),
raster_task_states_.end(),
RasterTaskState::TaskComparator(task)) !=
@@ -683,46 +682,23 @@ void PixelBufferRasterWorkerPool::CheckForCompletedRasterizerTasks() {
RasterTaskState& state = *state_it;
DCHECK_EQ(RasterTaskState::SCHEDULED, state.type);
- // Balanced with MapPixelRasterBuffer() call in AcquireCanvasForRaster().
- bool content_has_changed = resource_provider_->UnmapPixelRasterBuffer(
- raster_task->resource()->id());
-
- // |content_has_changed| can be false as result of task being canceled or
- // task implementation deciding not to modify bitmap (ie. analysis of raster
- // commands detected content as a solid color).
- if (!content_has_changed) {
- raster_task->WillComplete();
- raster_task->CompleteOnOriginThread(this);
- raster_task->DidComplete();
-
- if (!raster_task->HasFinishedRunning()) {
- // When priorites change, a raster task can be canceled as a result of
- // no longer being of high enough priority to fit in our throttled
- // raster task budget. The task has not yet completed in this case.
- RasterTaskQueue::Item::Vector::const_iterator item_it =
- std::find_if(raster_tasks_.items.begin(),
- raster_tasks_.items.end(),
- RasterTaskQueue::Item::TaskComparator(raster_task));
- if (item_it != raster_tasks_.items.end()) {
- state.type = RasterTaskState::UNSCHEDULED;
- continue;
- }
+ if (!raster_task->HasFinishedRunning()) {
reveman 2014/08/15 11:54:31 Should we release the raster buffer in this case?
auygun 2014/08/15 12:24:19 Buffer is relased in RasterTaskImpl::CompleteOnOri
reveman 2014/08/15 13:59:34 Acknowledged.
+ // When priorites change, a raster task can be canceled as a result of
+ // no longer being of high enough priority to fit in our throttled
+ // raster task budget. The task has not yet completed in this case.
+ RasterTaskQueue::Item::Vector::const_iterator item_it =
+ std::find_if(raster_tasks_.items.begin(),
+ raster_tasks_.items.end(),
+ RasterTaskQueue::Item::TaskComparator(raster_task));
+ if (item_it != raster_tasks_.items.end()) {
+ raster_task->WillComplete();
+ raster_task->CompleteOnOriginThread(this);
+ raster_task->DidComplete();
reveman 2014/08/15 11:54:31 These functions need to be called even if the cond
auygun 2014/08/15 12:24:20 Aren't they called later in CheckForCompletedUploa
reveman 2014/08/15 13:59:34 Acknowledged.
+ state.type = RasterTaskState::UNSCHEDULED;
+ continue;
}
-
- DCHECK(std::find(completed_raster_tasks_.begin(),
- completed_raster_tasks_.end(),
- raster_task) == completed_raster_tasks_.end());
- completed_raster_tasks_.push_back(raster_task);
- state.type = RasterTaskState::COMPLETED;
- DCHECK_LE(static_cast<size_t>(state.required_for_activation),
- raster_tasks_required_for_activation_count_);
- raster_tasks_required_for_activation_count_ -=
- state.required_for_activation;
reveman 2014/08/15 11:54:31 We still need this code in case the task is no lon
auygun 2014/08/15 12:24:20 Now the task is pushed into raster_tasks_with_pend
reveman 2014/08/15 13:59:34 It seemed a bit awkward to attempt an upload when
auygun 2014/08/15 15:08:23 Ok. I think it's better to not to attempt an uploa
- continue;
}
- DCHECK(raster_task->HasFinishedRunning());
-
resource_provider_->BeginSetPixels(raster_task->resource()->id());
has_performed_uploads_since_last_flush_ = true;

Powered by Google App Engine
This is Rietveld 408576698