Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
ResourceLoadManager.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/file/Path.h"
7#include "mc/deps/core/threading/Async.h"
8#include "mc/deps/core/utility/EnableNonOwnerReferences.h"
9#include "mc/platform/brstd/move_only_function.h"
10#include "mc/resources/ResourceLoadType.h"
11
12// auto generated forward declare list
13// clang-format off
14class Scheduler;
15class TaskGroup;
16class TaskResult;
17class WorkerPool;
19namespace Bedrock::Profiler::details { struct PredeclaredAnnotation; }
20// clang-format on
21
22class ResourceLoadManager : public ::Bedrock::EnableNonOwnerReferences {
23public:
24 // ResourceLoadManager inner types declare
25 // clang-format off
26 struct LoadOrder;
27 class TaskGroupState;
29 // clang-format on
30
31 // ResourceLoadManager inner types define
32 struct LoadOrder {};
33
34 class TaskGroupState {
35 public:
36 // member variables
37 // NOLINTBEGIN
40 // NOLINTEND
41
42 public:
43 // prevent constructor by default
44 TaskGroupState& operator=(TaskGroupState const&);
45 TaskGroupState(TaskGroupState const&);
46 TaskGroupState();
47 };
48
49 class ResourceLoadTaskGroup {
50 public:
51 // member variables
52 // NOLINTBEGIN
59 // NOLINTEND
60
61 public:
62 // prevent constructor by default
63 ResourceLoadTaskGroup& operator=(ResourceLoadTaskGroup const&);
64 ResourceLoadTaskGroup(ResourceLoadTaskGroup const&);
65 ResourceLoadTaskGroup();
66
67 public:
68 // member functions
69 // NOLINTBEGIN
70 MCNAPI ::Bedrock::Threading::Async<void> queue(
71 ::brstd::move_only_function<::TaskResult()> threadedCallback,
72 ::brstd::move_only_function<void()> mainThreadCallback,
73 uint taskPriority
74 );
75
76#ifdef LL_PLAT_C
77 MCNAPI ::Bedrock::Threading::Async<void>
78 queueAsync(::brstd::move_only_function<::TaskResult()> callback, uint taskPriority);
79
80 MCNAPI ::Bedrock::Threading::Async<void>
81 queueSync(::brstd::move_only_function<::TaskResult()> callback, uint taskPriority);
82#endif
83 // NOLINTEND
84 };
85
86public:
87 // member variables
88 // NOLINTBEGIN
89 ::ll::TypedStorage<4, 4, int> mRepeatedHitcountHACK;
90 ::ll::TypedStorage<8, 8, ::Scheduler&> mScheduler;
91 ::ll::TypedStorage<8, 8, ::WorkerPool&> mWorkerPool;
92 ::ll::TypedStorage<
93 8,
94 16,
95 ::std::map<::ResourceLoadType, ::std::unique_ptr<::ResourceLoadManager::ResourceLoadTaskGroup>>>
96 mResourceLoadTaskGroups;
97 ::ll::TypedStorage<8, 8, uint64> mAppSuspended;
98 ::ll::TypedStorage<1, 1, bool> mSupportsCancel;
99 ::ll::TypedStorage<8, 32, ::Core::Path const> mLoggingPath;
100 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::TaskGroup>>> mDispatchTaskGroup;
101 // NOLINTEND
102
103public:
104 // prevent constructor by default
105 ResourceLoadManager& operator=(ResourceLoadManager const&);
106 ResourceLoadManager(ResourceLoadManager const&);
107 ResourceLoadManager();
108
109public:
110 // virtual functions
111 // NOLINTBEGIN
112 virtual ~ResourceLoadManager() /*override*/ = default;
113 // NOLINTEND
114
115public:
116 // member functions
117 // NOLINTBEGIN
119
120#ifdef LL_PLAT_C
121 MCNAPI bool areDependenciesLoaded(::ResourceLoadType resourceLoadType) const;
122#endif
123
124 MCNAPI bool isComplete() const;
125
126#ifdef LL_PLAT_C
127 MCNAPI bool isComplete(::ResourceLoadType resourceLoadType) const;
128
129 MCNAPI void printRunningTasks();
130#endif
131
132 MCNAPI ::Bedrock::Threading::Async<void> queue(
133 ::ResourceLoadType resourceLoadType,
134 ::brstd::move_only_function<::TaskResult()> threadedCallback,
135 ::brstd::move_only_function<void()> mainThreadCallback,
136 uint taskPriority
137 );
138
139#ifdef LL_PLAT_C
140 MCNAPI ::Bedrock::Threading::Async<void> queueAsync(
141 ::ResourceLoadType resourceLoadType,
143 uint taskPriority
144 );
145#endif
146
147 MCNAPI ::Bedrock::Threading::Async<void> queueFromBackground(
148 ::ResourceLoadType resourceLoadType,
149 ::brstd::move_only_function<::TaskResult()> threadedCallback,
150 ::brstd::move_only_function<void()> mainThreadCallback,
151 uint taskPriority
152 );
153
154#ifdef LL_PLAT_C
155 MCNAPI ::Bedrock::Threading::Async<void> queueSync(
156 ::ResourceLoadType resourceLoadType,
158 uint taskPriority
159 );
160#endif
161
163 ::std::string_view groupName,
165 ::ResourceLoadType resourceLoadType,
166 ::std::vector<::ResourceLoadType> dependencies
167 );
168
169#ifdef LL_PLAT_C
170 MCNAPI void setAppSuspended(bool suspended);
171
172 MCNAPI void sync(::ResourceLoadType resourceLoadType);
173#endif
174
175 MCNAPI void update();
176 // NOLINTEND
177
178public:
179 // static functions
180 // NOLINTBEGIN
181 MCNAPI static void queueChild(
182 ::brstd::move_only_function<::TaskResult()> threadedCallback,
183 ::brstd::move_only_function<void()> mainThreadCallback,
184 uint taskPriority
185 );
186 // NOLINTEND
187
188public:
189 // constructor thunks
190 // NOLINTBEGIN
192 // NOLINTEND
193};
Definition EnableNonOwnerReferences.h:7
Definition ResourceLoadManager.h:49
MCAPI ::Bedrock::Threading::Async< void > queue(::brstd::move_only_function<::TaskResult()> threadedCallback, ::brstd::move_only_function< void()> mainThreadCallback, uint taskPriority)
Definition ResourceLoadManager.h:34
MCAPI void update()
MCAPI bool isComplete() const
MCAPI void * $ctor(::ResourceLoadManagerOptions &&ops)
MCAPI ResourceLoadManager(::ResourceLoadManagerOptions &&ops)
MCAPI ::Bedrock::Threading::Async< void > queueFromBackground(::ResourceLoadType resourceLoadType, ::brstd::move_only_function<::TaskResult()> threadedCallback, ::brstd::move_only_function< void()> mainThreadCallback, uint taskPriority)
MCAPI void registerResourceLoadTaskGroup(::std::string_view groupName, ::Bedrock::Profiler::details::PredeclaredAnnotation &&annotation, ::ResourceLoadType resourceLoadType, ::std::vector<::ResourceLoadType > dependencies)
static MCAPI void queueChild(::brstd::move_only_function<::TaskResult()> threadedCallback, ::brstd::move_only_function< void()> mainThreadCallback, uint taskPriority)
MCAPI ::Bedrock::Threading::Async< void > queue(::ResourceLoadType resourceLoadType, ::brstd::move_only_function<::TaskResult()> threadedCallback, ::brstd::move_only_function< void()> mainThreadCallback, uint taskPriority)
Definition Scheduler.h:15
Definition TaskGroup.h:85
Definition TaskResult.h:5
Definition WorkerPool.h:22
Definition move_only_function.h:9
Definition PredeclaredAnnotation.h:7
Definition ResourceLoadManagerOptions.h:14
Definition ResourceLoadManager.h:32
Definition Alias.h:14