Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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;
19
20class TaskList {
21public:
22 TaskList() = default;
23
24 void add(TaskList&& tasks) { fTasks.move_back(tasks.fTasks); }
25 void add(sk_sp<Task> task) { fTasks.emplace_back(std::move(task)); }
26 void reset() { fTasks.clear(); }
27
28 int size() const { return fTasks.size(); }
29 bool hasTasks() const { return !fTasks.empty(); }
30
31 // Returns kSuccess if no child task failed and at least one child didn't return kDiscard.
32 // Returns kDiscard if all children were discarded.
33 // Returns kFail if any child failed.
34 // Automatically removes tasks from its list if they return kDiscard.
37
38private:
39 template <typename Fn> // (Task*)->Status
40 Task::Status visitTasks(Fn);
41
43};
44
45} // namespace skgpu::graphite
46
47#endif // skgpu_graphite_task_TaskList_DEFINED
void add(sk_sp< Task > task)
Definition TaskList.h:25
Task::Status addCommands(Context *, CommandBuffer *, Task::ReplayTargetData)
Definition TaskList.cpp:44
bool hasTasks() const
Definition TaskList.h:29
Task::Status prepareResources(ResourceProvider *, const RuntimeEffectDictionary *)
Definition TaskList.cpp:36
void add(TaskList &&tasks)
Definition TaskList.h:24