Flutter Engine
The Flutter Engine
TaskList.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef skgpu_graphite_task_TaskList_DEFINED
9#define skgpu_graphite_task_TaskList_DEFINED
10
13
14namespace skgpu::graphite {
15
16class CommandBuffer;
17class Context;
19class ScratchResourceManager;
20
21class TaskList {
22public:
23 TaskList() = default;
24
25 void add(TaskList&& tasks) { fTasks.move_back(tasks.fTasks); }
26 void add(sk_sp<Task> task) { fTasks.emplace_back(std::move(task)); }
27 void reset() { fTasks.clear(); }
28
29 int size() const { return fTasks.size(); }
30 bool hasTasks() const { return !fTasks.empty(); }
31
32 // Returns kSuccess if no child task failed and at least one child didn't return kDiscard.
33 // Returns kDiscard if all children were discarded.
34 // Returns kFail if any child failed.
35 // Automatically removes tasks from its list if they return kDiscard.
40
41private:
42 template <typename Fn> // (Task*)->Status
43 Task::Status visitTasks(Fn);
44
46};
47
48} // namespace skgpu::graphite
49
50#endif // skgpu_graphite_task_TaskList_DEFINED
void add(sk_sp< Task > task)
Definition: TaskList.h:26
Task::Status addCommands(Context *, CommandBuffer *, Task::ReplayTargetData)
Definition: TaskList.cpp:50
bool hasTasks() const
Definition: TaskList.h:30
Task::Status prepareResources(ResourceProvider *, ScratchResourceManager *, const RuntimeEffectDictionary *)
Definition: TaskList.cpp:38
void add(TaskList &&tasks)
Definition: TaskList.h:25