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

Unified Diff: cc/resources/pixel_buffer_raster_worker_pool.cc

Issue 23619048: cc: Clean up PBRWP::ScheduleTasks a bit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
« no previous file with comments | « cc/resources/pixel_buffer_raster_worker_pool.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 48e6f9a114b58e34743c5396e66b16b91602a081..f2990b2eaef1c5109934efe61f8fa644e744e3cf 100644
--- a/cc/resources/pixel_buffer_raster_worker_pool.cc
+++ b/cc/resources/pixel_buffer_raster_worker_pool.cc
@@ -148,6 +148,8 @@ void PixelBufferRasterWorkerPool::ScheduleTasks(RasterTask::Queue* queue) {
should_notify_client_if_no_tasks_are_pending_ = true;
should_notify_client_if_no_tasks_required_for_activation_are_pending_ = true;
+ tasks_required_for_activation_.clear();
+
// Build new pixel buffer task set.
TaskMap new_pixel_buffer_tasks;
for (RasterTaskVector::const_iterator it = raster_tasks().begin();
@@ -156,15 +158,11 @@ void PixelBufferRasterWorkerPool::ScheduleTasks(RasterTask::Queue* queue) {
DCHECK(new_pixel_buffer_tasks.find(task) == new_pixel_buffer_tasks.end());
DCHECK(!task->HasCompleted());
- // Use existing pixel buffer task if available.
- TaskMap::iterator pixel_buffer_it = pixel_buffer_tasks_.find(task);
- if (pixel_buffer_it == pixel_buffer_tasks_.end()) {
- new_pixel_buffer_tasks[task] = NULL;
- continue;
- }
-
- new_pixel_buffer_tasks[task] = pixel_buffer_it->second;
+ new_pixel_buffer_tasks[task] = pixel_buffer_tasks_[task];
pixel_buffer_tasks_.erase(task);
+
+ if (IsRasterTaskRequiredForActivation(task))
+ tasks_required_for_activation_.insert(task);
}
// Transfer remaining pixel buffer tasks to |new_pixel_buffer_tasks|
@@ -184,23 +182,19 @@ void PixelBufferRasterWorkerPool::ScheduleTasks(RasterTask::Queue* queue) {
completed_tasks_.end(),
task) == completed_tasks_.end());
completed_tasks_.push_back(task);
- }
- }
-
- tasks_required_for_activation_.clear();
- for (TaskMap::iterator it = new_pixel_buffer_tasks.begin();
- it != new_pixel_buffer_tasks.end(); ++it) {
- internal::RasterWorkerPoolTask* task = it->first;
- if (IsRasterTaskRequiredForActivation(task))
+ } else if (IsRasterTaskRequiredForActivation(task)) {
tasks_required_for_activation_.insert(task);
+ }
}
- // |tasks_required_for_activation_| contains all tasks that need to
- // complete before we can send a "ready to activate" signal. Tasks
- // that have already completed should not be part of this set.
- for (TaskDeque::const_iterator it = completed_tasks_.begin();
- it != completed_tasks_.end(); ++it) {
- tasks_required_for_activation_.erase(*it);
+ if (!tasks_required_for_activation_.empty()) {
reveman 2013/09/13 16:51:46 this is just an optimization, right? can you inste
vmpstr 2013/09/16 16:09:16 Done. I did an explicit if/break, but it could als
+ // |tasks_required_for_activation_| contains all tasks that need to
+ // complete before we can send a "ready to activate" signal. Tasks
+ // that have already completed should not be part of this set.
+ for (TaskDeque::const_iterator it = completed_tasks_.begin();
+ it != completed_tasks_.end(); ++it) {
+ tasks_required_for_activation_.erase(*it);
+ }
}
pixel_buffer_tasks_.swap(new_pixel_buffer_tasks);
« no previous file with comments | « cc/resources/pixel_buffer_raster_worker_pool.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698