| Index: cc/tiles/gpu_image_decode_controller_unittest.cc | 
| diff --git a/cc/tiles/gpu_image_decode_controller_unittest.cc b/cc/tiles/gpu_image_decode_controller_unittest.cc | 
| index 1891f2e55710e4e4ec3ac055a2327a02038063d0..7d19d8dd86fd2ffe592017d13e6b39498f2e4c71 100644 | 
| --- a/cc/tiles/gpu_image_decode_controller_unittest.cc | 
| +++ b/cc/tiles/gpu_image_decode_controller_unittest.cc | 
| @@ -32,25 +32,24 @@ SkMatrix CreateMatrix(const SkSize& scale, bool is_decomposable) { | 
| } | 
|  | 
| void ScheduleTask(TileTask* task) { | 
| -  task->WillSchedule(); | 
| -  task->ScheduleOnOriginThread(nullptr); | 
| -  task->DidSchedule(); | 
| +  task->state().DidSchedule(); | 
| } | 
|  | 
| +// Before running the task it must be scheduled. Call ScheduleTask() before | 
| +// calling this function. | 
| void RunTask(TileTask* task) { | 
| -  // TODO(prashant.n): Once ScheduleOnOriginThread() and | 
| -  // CompleteOnOriginThread() functions are removed, modify this function | 
| -  // accordingly. (crbug.com/599863) | 
| -  task->state().DidSchedule(); | 
| task->state().DidStart(); | 
| task->RunOnWorkerThread(); | 
| task->state().DidFinish(); | 
| } | 
|  | 
| void CompleteTask(TileTask* task) { | 
| -  task->WillComplete(); | 
| -  task->CompleteOnOriginThread(nullptr); | 
| -  task->DidComplete(); | 
| +  DCHECK(task->state().IsFinished() || task->state().IsCanceled()); | 
| +  task->OnTaskCompleted(); | 
| +} | 
| + | 
| +void CancelTask(TileTask* task) { | 
| +  task->state().DidCancel(); | 
| } | 
|  | 
| void ProcessTask(TileTask* task) { | 
| @@ -157,7 +156,7 @@ TEST(GpuImageDecodeControllerTest, GetTaskForImageAlreadyDecodedAndLocked) { | 
| RunTask(task->dependencies()[0].get()); | 
|  | 
| // Cancel the upload. | 
| -  ScheduleTask(task.get()); | 
| +  CancelTask(task.get()); | 
| CompleteTask(task.get()); | 
|  | 
| // Get the image again - we should have an upload task, but no dependent | 
| @@ -202,7 +201,7 @@ TEST(GpuImageDecodeControllerTest, GetTaskForImageAlreadyDecodedNotLocked) { | 
| ProcessTask(task->dependencies()[0].get()); | 
|  | 
| // Cancel the upload. | 
| -  ScheduleTask(task.get()); | 
| +  CancelTask(task.get()); | 
| CompleteTask(task.get()); | 
|  | 
| // Unref the image. | 
| @@ -279,7 +278,6 @@ TEST(GpuImageDecodeControllerTest, GetTaskForImageCanceledGetsNewTask) { | 
| EXPECT_TRUE(task); | 
|  | 
| ProcessTask(task->dependencies()[0].get()); | 
| -  ScheduleTask(task.get()); | 
|  | 
| scoped_refptr<TileTask> another_task; | 
| need_unref = controller.GetTaskForImageAndRef( | 
| @@ -287,7 +285,8 @@ TEST(GpuImageDecodeControllerTest, GetTaskForImageCanceledGetsNewTask) { | 
| EXPECT_TRUE(need_unref); | 
| EXPECT_TRUE(another_task.get() == task.get()); | 
|  | 
| -  // Didn't run the task, complete it (it was canceled). | 
| +  // Didn't run the task, so cancel it. | 
| +  CancelTask(task.get()); | 
| CompleteTask(task.get()); | 
|  | 
| // Fully cancel everything (so the raster would unref things). | 
| @@ -328,7 +327,6 @@ TEST(GpuImageDecodeControllerTest, | 
| EXPECT_TRUE(task); | 
|  | 
| ProcessTask(task->dependencies()[0].get()); | 
| -  ScheduleTask(task.get()); | 
|  | 
| scoped_refptr<TileTask> another_task; | 
| need_unref = controller.GetTaskForImageAndRef( | 
| @@ -336,7 +334,8 @@ TEST(GpuImageDecodeControllerTest, | 
| EXPECT_TRUE(need_unref); | 
| EXPECT_TRUE(another_task.get() == task.get()); | 
|  | 
| -  // Didn't run the task, complete it (it was canceled). | 
| +  // Didn't run the task, so cancel it. | 
| +  CancelTask(task.get()); | 
| CompleteTask(task.get()); | 
|  | 
| // Note that here, everything is reffed, but a new task is created. This is | 
| @@ -376,8 +375,8 @@ TEST(GpuImageDecodeControllerTest, NoTaskForImageAlreadyFailedDecoding) { | 
| EXPECT_TRUE(task); | 
|  | 
| ProcessTask(task->dependencies()[0].get()); | 
| -  ScheduleTask(task.get()); | 
| -  // Didn't run the task, complete it (it was canceled). | 
| +  // Didn't run the task, so cancel it. | 
| +  CancelTask(task.get()); | 
| CompleteTask(task.get()); | 
|  | 
| controller.SetImageDecodingFailedForTesting(draw_image); | 
| @@ -652,9 +651,9 @@ TEST(GpuImageDecodeControllerTest, CanceledTasksDoNotCountAgainstBudget) { | 
| EXPECT_TRUE(task); | 
| EXPECT_TRUE(need_unref); | 
|  | 
| -  ScheduleTask(task->dependencies()[0].get()); | 
| +  CancelTask(task->dependencies()[0].get()); | 
| CompleteTask(task->dependencies()[0].get()); | 
| -  ScheduleTask(task.get()); | 
| +  CancelTask(task.get()); | 
| CompleteTask(task.get()); | 
|  | 
| controller.UnrefImage(draw_image); | 
|  |