[go: nahoru, domu]

cc: Remove ScheduleOnOriginThread() and CompleteOnOriginThread().

The task's job is performed in RunOnWorkerThread() and schedule or
complete are not needed as a part of task's job. Those are the
responsibilities of task's owner (TileManager - compositor thread).
This patch removes following functions which were basically needed for
async upload. Now raster buffer is provided to task at the time of ctor
and functionality of CompleteOnOriginThread() is moved to task's owner.

  ScheduleOnOriginThread()
  CompleteOnOriginThread()

New OnTaskCompleted() function calls corresponding function of task
owner. This patch implements following life cycle for the task.

  1. Task's owner creates task with all needed info on origin thread.
  2. Task is scheduled and run on worker thread.
  3. Completed task is processed on origin thread by task owner.
  4. Task is destroyed.

This patch also fixes few task related failing cc_perftests (607818).

BUG=499372, 599863, 607818, 613529
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel

Review-Url: https://codereview.chromium.org/1866043006
Cr-Commit-Position: refs/heads/master@{#396218}
diff --git a/cc/raster/task.h b/cc/raster/task.h
index 54bcf8b6..ba8daef 100644
--- a/cc/raster/task.h
+++ b/cc/raster/task.h
@@ -15,11 +15,27 @@
 namespace cc {
 class Task;
 
-// States to manage life cycle of a task. Task gets created with NEW state and
-// concludes either in FINISHED or CANCELLED state. So possible life cycle
-// paths for task are -
-//   NEW -> SCHEDULED -> RUNNING -> FINISHED
-//   NEW -> SCHEDULED -> CANCELED
+// This class provides states to manage life cycle of a task and given below is
+// how it is used by TaskGraphWorkQueue to process life cycle of a task.
+// Task is in NEW state when it is created. When task is added to
+// |ready_to_run_tasks| then its state is changed to SCHEDULED. Task can be
+// canceled from NEW state (not yet scheduled to run) or from SCHEDULED state,
+// when new ScheduleTasks() is triggered and its state is changed to CANCELED.
+// When task is about to run it is added |running_tasks| and its state is
+// changed to RUNNING. Once task finishes running, its state is changed to
+// FINISHED. Both CANCELED and FINISHED tasks are added to |completed_tasks|.
+//                ╔═════╗
+//         +------║ NEW ║------+
+//         |      ╚═════╝      |
+//         v                   v
+//   ┌───────────┐        ╔══════════╗
+//   │ SCHEDULED │------> ║ CANCELED ║
+//   └───────────┘        ╚══════════╝
+//         |
+//         v
+//    ┌─────────┐         ╔══════════╗
+//    │ RUNNING │-------> ║ FINISHED ║
+//    └─────────┘         ╚══════════╝
 class CC_EXPORT TaskState {
  public:
   bool IsScheduled() const;