1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "cc/test/test_tile_task_runner.h"
6 
7 #include "base/check.h"
8 
9 namespace cc {
10 
ProcessTask(TileTask * task)11 void TestTileTaskRunner::ProcessTask(TileTask* task) {
12   ScheduleTask(task);
13   RunTask(task);
14   CompleteTask(task);
15 }
16 
ScheduleTask(TileTask * task)17 void TestTileTaskRunner::ScheduleTask(TileTask* task) {
18   DCHECK(task);
19   task->state().DidSchedule();
20 }
21 
CancelTask(TileTask * task)22 void TestTileTaskRunner::CancelTask(TileTask* task) {
23   DCHECK(task);
24   task->state().DidCancel();
25 }
26 
RunTask(TileTask * task)27 void TestTileTaskRunner::RunTask(TileTask* task) {
28   DCHECK(task);
29   task->state().DidStart();
30   task->RunOnWorkerThread();
31   task->state().DidFinish();
32 }
33 
CompleteTask(TileTask * task)34 void TestTileTaskRunner::CompleteTask(TileTask* task) {
35   DCHECK(task);
36   DCHECK(task->state().IsFinished() || task->state().IsCanceled());
37   task->OnTaskCompleted();
38   task->DidComplete();
39 }
40 
41 }  // namespace cc
42