MCPcopy Create free account
hub / github.com/BobbyAnguelov/Esoterica / Update

Method Update

Code/Base/Resource/ResourceSystem.cpp:255–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253
254 Threading::RecursiveScopeLock lock( m_accessLock );
255 auto predicate = [] ( ResourceRequest const* pRequest, ResourceRecord const* pResourceRecord ) { return pRequest->GetResourceRecord() == pResourceRecord; };
256 int32_t const foundIdx = VectorFindIndex( m_activeRequests, pResourceRecord, predicate );
257
258 if ( foundIdx != InvalidIndex )
259 {
260 return m_activeRequests[foundIdx];
261 }
262
263 return nullptr;
264 }
265
266 //-------------------------------------------------------------------------
267
268 void ResourceSystem::UpdateResourceProvider()
269 {
270 Threading::RecursiveScopeLock lock( m_accessLock );
271 m_pResourceProvider->Update();
272
273 //-------------------------------------------------------------------------
274
275 #if EE_DEVELOPMENT_TOOLS
276 for ( auto const& updatedResourceID : m_pResourceProvider->GetExternallyUpdatedResources() )
277 {
278 RequestResourceHotReload( updatedResourceID );
279 }
280 #endif
281 }
282
283 void ResourceSystem::Update( bool waitForAsyncTask )
284 {
285 EE_PROFILE_FUNCTION_RESOURCE();
286 EE_ASSERT( Threading::IsMainThread() );
287 EE_ASSERT( m_pResourceProvider != nullptr );
288
289 // Update resource provider
290 //-------------------------------------------------------------------------
291 // This will also update the hot-reload data
292
293 UpdateResourceProvider();
294
295 // Wait for async task to complete
296 //-------------------------------------------------------------------------
297
298 // If we've specified to wait for the async-task to complete, block
299 if ( waitForAsyncTask )
300 {
301 m_taskSystem.WaitForTask( &m_asyncProcessingTask );
302 }
303
304 if ( m_isAsyncTaskRunning && !m_asyncProcessingTask.GetIsComplete() )
305 {
306 return;
307 }
308
309 m_isAsyncTaskRunning = false;
310
311 // Process and Update requests
312 //-------------------------------------------------------------------------

Callers 2

Calls 15

IsMainThreadFunction · 0.85
DeleteFunction · 0.85
CompletedRequestLogClass · 0.85
GetIsCompleteMethod · 0.80
SwitchToLoadTaskMethod · 0.80
SwitchToUnloadTaskMethod · 0.80
IsLoadedMethod · 0.45
findMethod · 0.45
GetResourceTypeIDMethod · 0.45
endMethod · 0.45
emplace_backMethod · 0.45
IsUnloadedMethod · 0.45

Tested by

no test coverage detected