MCPcopy Create free account
hub / github.com/defold/defold / DeletePreloader

Function DeletePreloader

engine/resource/src/resource_preloader.cpp:1033–1064  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1031 }
1032
1033 void DeletePreloader(HPreloader preloader)
1034 {
1035 // Since Preload calls need their Create calls done and PostCreate calls must always follow Create calls.
1036 // To fix this:
1037 // * Make Get calls insta-fail on RESULT_ABORTED or something
1038 // * Make Queue only return RESULT_ABORTED always.
1039 // This is not a super-important use-case, the only way to trigger this is to start a load and
1040 // then do unload before it completes or if you destroy the collection while loading.
1041 // The normal operation is to issue a load and progress once complete.
1042 while (UpdatePreloader(preloader, 0, 0, 1000000) == RESULT_PENDING)
1043 {
1044 dmLogWarning("Waiting for preloader to complete.");
1045 }
1046
1047 // Release root and persisted resources
1048 preloader->m_PersistedResources.Push(preloader->m_Request[0].m_Resource);
1049 for (uint32_t i = 0; i < preloader->m_PersistedResources.Size(); ++i)
1050 {
1051 void* resource = preloader->m_PersistedResources[i];
1052 if (!resource)
1053 continue;
1054 Release(preloader->m_Factory, resource);
1055 }
1056
1057 assert(preloader->m_FreelistSize == (MAX_PRELOADER_REQUESTS - 1));
1058 dmLoadQueue::DeleteQueue(preloader->m_LoadQueue);
1059
1060 dmBlockAllocator::DeleteContext(preloader->m_BlockAllocator);
1061
1062 dmSpinlock::Destroy(&preloader->m_SyncedDataSpinlock);
1063 delete preloader;
1064 }
1065
1066 bool PreloadHint(HResourcePreloadHintInfo info, const char* name)
1067 {

Callers 9

PreloaderGetMethod · 0.85
PreloaderGetMethod · 0.85
TEST_PFunction · 0.85
CleanupAsyncLoadingFunction · 0.85
CleanupAsyncLoadingFunction · 0.85
TEST_PFunction · 0.85

Calls 8

UpdatePreloaderFunction · 0.85
ReleaseFunction · 0.70
DeleteContextFunction · 0.70
DestroyFunction · 0.70
assertFunction · 0.50
DeleteQueueFunction · 0.50
PushMethod · 0.45
SizeMethod · 0.45

Tested by 4

PreloaderGetMethod · 0.68
PreloaderGetMethod · 0.68
TEST_PFunction · 0.68
TEST_PFunction · 0.68