summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorskyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-09 22:11:06 +0000
committerskyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-09 22:11:06 +0000
commitdb97b49fdd856f33bd810db4564c6f2cc14be71a (patch)
tree48f2ab281af367c202ae93a5faf3e1df600da100
parent555a20aa21348589860b354dd6e64cafd02a5058 (diff)
downloadchromium_src-db97b49fdd856f33bd810db4564c6f2cc14be71a.zip
chromium_src-db97b49fdd856f33bd810db4564c6f2cc14be71a.tar.gz
chromium_src-db97b49fdd856f33bd810db4564c6f2cc14be71a.tar.bz2
cc: Simplify raster task completion notification logic
(Relanding after missing activation bug fixed in https://codereview.chromium.org/131763003/) Previously the pixel buffer raster worker pool used a combination of polling and explicit notifications from the raster worker pool to decide when to tell the client about the completion of 1) all tasks or 2) the subset of tasks required for activation. This patch simplifies the logic by only triggering the notification based on the OnRasterTasksFinished and OnRasterTasksRequiredForActivationFinished calls from the worker pool. BUG=307841,331534 Review URL: https://codereview.chromium.org/99873007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243991 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/resources/pixel_buffer_raster_worker_pool.cc10
-rw-r--r--cc/resources/pixel_buffer_raster_worker_pool.h2
2 files changed, 11 insertions, 1 deletions
diff --git a/cc/resources/pixel_buffer_raster_worker_pool.cc b/cc/resources/pixel_buffer_raster_worker_pool.cc
index b9f6578..76472f6 100644
--- a/cc/resources/pixel_buffer_raster_worker_pool.cc
+++ b/cc/resources/pixel_buffer_raster_worker_pool.cc
@@ -103,7 +103,9 @@ PixelBufferRasterWorkerPool::PixelBufferRasterWorkerPool(
check_for_completed_raster_tasks_pending_(false),
should_notify_client_if_no_tasks_are_pending_(false),
should_notify_client_if_no_tasks_required_for_activation_are_pending_(
- false) {
+ false),
+ raster_finished_task_pending_(false),
+ raster_required_for_activation_finished_task_pending_(false) {
}
PixelBufferRasterWorkerPool::~PixelBufferRasterWorkerPool() {
@@ -264,6 +266,7 @@ void PixelBufferRasterWorkerPool::OnRasterTasksFinished() {
// perform another check in that case as we've already notified the client.
if (!should_notify_client_if_no_tasks_are_pending_)
return;
+ raster_finished_task_pending_ = false;
// Call CheckForCompletedRasterTasks() when we've finished running all
// raster tasks needed since last time ScheduleTasks() was called.
@@ -277,6 +280,7 @@ void PixelBufferRasterWorkerPool::OnRasterTasksRequiredForActivationFinished() {
// CheckForCompletedRasterTasks() if the client has already been notified.
if (!should_notify_client_if_no_tasks_required_for_activation_are_pending_)
return;
+ raster_required_for_activation_finished_task_pending_ = false;
// This reduces latency between the time when all tasks required for
// activation have finished running and the time when the client is
@@ -395,9 +399,11 @@ void PixelBufferRasterWorkerPool::CheckForCompletedRasterTasks() {
// Determine what client notifications to generate.
bool will_notify_client_that_no_tasks_required_for_activation_are_pending =
(should_notify_client_if_no_tasks_required_for_activation_are_pending_ &&
+ !raster_required_for_activation_finished_task_pending_ &&
!HasPendingTasksRequiredForActivation());
bool will_notify_client_that_no_tasks_are_pending =
(should_notify_client_if_no_tasks_are_pending_ &&
+ !raster_finished_task_pending_ &&
!HasPendingTasks());
// Adjust the need to generate notifications before scheduling more tasks.
@@ -548,6 +554,7 @@ void PixelBufferRasterWorkerPool::ScheduleMoreTasks() {
should_notify_client_if_no_tasks_required_for_activation_are_pending_) {
new_raster_required_for_activation_finished_task =
CreateRasterRequiredForActivationFinishedTask();
+ raster_required_for_activation_finished_task_pending_ = true;
internal::GraphNode* raster_required_for_activation_finished_node =
CreateGraphNodeForTask(
new_raster_required_for_activation_finished_task.get(),
@@ -569,6 +576,7 @@ void PixelBufferRasterWorkerPool::ScheduleMoreTasks() {
if (!did_throttle_raster_tasks &&
should_notify_client_if_no_tasks_are_pending_) {
new_raster_finished_task = CreateRasterFinishedTask();
+ raster_finished_task_pending_ = true;
internal::GraphNode* raster_finished_node =
CreateGraphNodeForTask(new_raster_finished_task.get(),
1u, // Priority 1
diff --git a/cc/resources/pixel_buffer_raster_worker_pool.h b/cc/resources/pixel_buffer_raster_worker_pool.h
index 1a0f1ee..94ed284 100644
--- a/cc/resources/pixel_buffer_raster_worker_pool.h
+++ b/cc/resources/pixel_buffer_raster_worker_pool.h
@@ -81,6 +81,8 @@ class CC_EXPORT PixelBufferRasterWorkerPool : public RasterWorkerPool {
bool should_notify_client_if_no_tasks_are_pending_;
bool should_notify_client_if_no_tasks_required_for_activation_are_pending_;
+ bool raster_finished_task_pending_;
+ bool raster_required_for_activation_finished_task_pending_;
ResourceFormat format_;
DISALLOW_COPY_AND_ASSIGN(PixelBufferRasterWorkerPool);