1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
cc / test / fake_tile_task_manager.cc [blame]
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/test/fake_tile_task_manager.h"
#include <utility>
namespace cc {
FakeTileTaskManagerImpl::FakeTileTaskManagerImpl() = default;
FakeTileTaskManagerImpl::~FakeTileTaskManagerImpl() {
DCHECK_EQ(0u, completed_tasks_.size());
}
void FakeTileTaskManagerImpl::ScheduleTasks(TaskGraph* graph) {
for (const auto& node : graph->nodes) {
TileTask* task = static_cast<TileTask*>(node.task.get());
// Cancel the task and append to |completed_tasks_|.
task->state().DidCancel();
completed_tasks_.push_back(node.task);
}
}
void FakeTileTaskManagerImpl::CheckForCompletedTasks() {
for (auto& task : completed_tasks_) {
DCHECK(task->state().IsFinished() || task->state().IsCanceled());
TileTask* tile_task = static_cast<TileTask*>(task.get());
tile_task->OnTaskCompleted();
tile_task->DidComplete();
if (auto& dependent = tile_task->external_dependent()) {
std::move(dependent)->ExternalDependencyCompleted();
}
}
completed_tasks_.clear();
}
void FakeTileTaskManagerImpl::ExternalDependencyCompletedForTask(
scoped_refptr<TileTask>) {}
void FakeTileTaskManagerImpl::Shutdown() {}
} // namespace cc