MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Update

Method Update

Source/Engine/Content/Content.cpp:165–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165void ContentService::Update()
166{
167 PROFILE_CPU();
168
169#if PLATFORM_THREADS_LIMIT == 1
170 // Run content-streaming tasks on a main thread
171 if (LoadTasks.HasItems())
172 {
173 double timeLimit = 0.01; // 10ms
174 double startTime = Platform::GetTimeSeconds();
175 do
176 {
177 auto task = LoadTasks[0];
178 LoadTasks.RemoveAt(0);
179 MainLoadThread->Run(task);
180 } while (LoadTasks.HasItems() && Platform::GetTimeSeconds() - startTime < timeLimit);
181 }
182#endif
183
184 // Broadcast `OnLoaded` events
185 LoadedAssetsToInvokeLocker.Lock();
186 while (LoadedAssetsToInvoke.HasItems())
187 {
188 auto asset = LoadedAssetsToInvoke.Dequeue();
189 asset->onLoaded_MainThread();
190#if USE_EDITOR
191 Content::onAddDependencies(asset);
192#endif
193 }
194 LoadedAssetsToInvokeLocker.Unlock();
195}
196
197void ContentService::LateUpdate()
198{

Callers

nothing calls this directly

Calls 7

LockMethod · 0.80
UnlockMethod · 0.80
HasItemsMethod · 0.45
RemoveAtMethod · 0.45
RunMethod · 0.45
DequeueMethod · 0.45
onLoaded_MainThreadMethod · 0.45

Tested by

no test coverage detected