Commit db97b49f authored by skyostil@chromium.org's avatar skyostil@chromium.org

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
parent 555a20aa
...@@ -103,7 +103,9 @@ PixelBufferRasterWorkerPool::PixelBufferRasterWorkerPool( ...@@ -103,7 +103,9 @@ PixelBufferRasterWorkerPool::PixelBufferRasterWorkerPool(
check_for_completed_raster_tasks_pending_(false), check_for_completed_raster_tasks_pending_(false),
should_notify_client_if_no_tasks_are_pending_(false), should_notify_client_if_no_tasks_are_pending_(false),
should_notify_client_if_no_tasks_required_for_activation_are_pending_( 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() { PixelBufferRasterWorkerPool::~PixelBufferRasterWorkerPool() {
...@@ -264,6 +266,7 @@ void PixelBufferRasterWorkerPool::OnRasterTasksFinished() { ...@@ -264,6 +266,7 @@ void PixelBufferRasterWorkerPool::OnRasterTasksFinished() {
// perform another check in that case as we've already notified the client. // perform another check in that case as we've already notified the client.
if (!should_notify_client_if_no_tasks_are_pending_) if (!should_notify_client_if_no_tasks_are_pending_)
return; return;
raster_finished_task_pending_ = false;
// Call CheckForCompletedRasterTasks() when we've finished running all // Call CheckForCompletedRasterTasks() when we've finished running all
// raster tasks needed since last time ScheduleTasks() was called. // raster tasks needed since last time ScheduleTasks() was called.
...@@ -277,6 +280,7 @@ void PixelBufferRasterWorkerPool::OnRasterTasksRequiredForActivationFinished() { ...@@ -277,6 +280,7 @@ void PixelBufferRasterWorkerPool::OnRasterTasksRequiredForActivationFinished() {
// CheckForCompletedRasterTasks() if the client has already been notified. // CheckForCompletedRasterTasks() if the client has already been notified.
if (!should_notify_client_if_no_tasks_required_for_activation_are_pending_) if (!should_notify_client_if_no_tasks_required_for_activation_are_pending_)
return; return;
raster_required_for_activation_finished_task_pending_ = false;
// This reduces latency between the time when all tasks required for // This reduces latency between the time when all tasks required for
// activation have finished running and the time when the client is // activation have finished running and the time when the client is
...@@ -395,9 +399,11 @@ void PixelBufferRasterWorkerPool::CheckForCompletedRasterTasks() { ...@@ -395,9 +399,11 @@ void PixelBufferRasterWorkerPool::CheckForCompletedRasterTasks() {
// Determine what client notifications to generate. // Determine what client notifications to generate.
bool will_notify_client_that_no_tasks_required_for_activation_are_pending = bool will_notify_client_that_no_tasks_required_for_activation_are_pending =
(should_notify_client_if_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()); !HasPendingTasksRequiredForActivation());
bool will_notify_client_that_no_tasks_are_pending = bool will_notify_client_that_no_tasks_are_pending =
(should_notify_client_if_no_tasks_are_pending_ && (should_notify_client_if_no_tasks_are_pending_ &&
!raster_finished_task_pending_ &&
!HasPendingTasks()); !HasPendingTasks());
// Adjust the need to generate notifications before scheduling more tasks. // Adjust the need to generate notifications before scheduling more tasks.
...@@ -548,6 +554,7 @@ void PixelBufferRasterWorkerPool::ScheduleMoreTasks() { ...@@ -548,6 +554,7 @@ void PixelBufferRasterWorkerPool::ScheduleMoreTasks() {
should_notify_client_if_no_tasks_required_for_activation_are_pending_) { should_notify_client_if_no_tasks_required_for_activation_are_pending_) {
new_raster_required_for_activation_finished_task = new_raster_required_for_activation_finished_task =
CreateRasterRequiredForActivationFinishedTask(); CreateRasterRequiredForActivationFinishedTask();
raster_required_for_activation_finished_task_pending_ = true;
internal::GraphNode* raster_required_for_activation_finished_node = internal::GraphNode* raster_required_for_activation_finished_node =
CreateGraphNodeForTask( CreateGraphNodeForTask(
new_raster_required_for_activation_finished_task.get(), new_raster_required_for_activation_finished_task.get(),
...@@ -569,6 +576,7 @@ void PixelBufferRasterWorkerPool::ScheduleMoreTasks() { ...@@ -569,6 +576,7 @@ void PixelBufferRasterWorkerPool::ScheduleMoreTasks() {
if (!did_throttle_raster_tasks && if (!did_throttle_raster_tasks &&
should_notify_client_if_no_tasks_are_pending_) { should_notify_client_if_no_tasks_are_pending_) {
new_raster_finished_task = CreateRasterFinishedTask(); new_raster_finished_task = CreateRasterFinishedTask();
raster_finished_task_pending_ = true;
internal::GraphNode* raster_finished_node = internal::GraphNode* raster_finished_node =
CreateGraphNodeForTask(new_raster_finished_task.get(), CreateGraphNodeForTask(new_raster_finished_task.get(),
1u, // Priority 1 1u, // Priority 1
......
...@@ -81,6 +81,8 @@ class CC_EXPORT PixelBufferRasterWorkerPool : public RasterWorkerPool { ...@@ -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_are_pending_;
bool should_notify_client_if_no_tasks_required_for_activation_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_; ResourceFormat format_;
DISALLOW_COPY_AND_ASSIGN(PixelBufferRasterWorkerPool); DISALLOW_COPY_AND_ASSIGN(PixelBufferRasterWorkerPool);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment