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

Function PreloaderTryPruneParent

engine/resource/src/resource_preloader.cpp:682–698  ·  view source on GitHub ↗

Try to create the resource of the parent if all the child requests has been resolved. We continue up the parent chain until we find a parent where all children are not resolved and we break Returns true if at least one parent in the chain is created

Source from the content-addressed store, hash-verified

680 // children are not resolved and we break
681 // Returns true if at least one parent in the chain is created
682 static bool PreloaderTryPruneParent(HPreloader preloader, PreloadRequest* req)
683 {
684 TRequestIndex parent = req->m_Parent;
685 if (parent == -1)
686 {
687 return false;
688 }
689 PreloadRequest* parent_req = &preloader->m_Request[parent];
690 if (parent_req->m_PendingChildCount > 0)
691 {
692 return false;
693 }
694 CreateResource(preloader, parent_req, 0, 0, 0);
695 UnmarkPathInProgress(preloader, &parent_req->m_PathDescriptor);
696 PreloaderTryPruneParent(preloader, parent_req);
697 return true;
698 }
699
700 // Ends the Load part of the resource and handles the result of the load
701 // It will create the resource if it has no children, otherwise it will

Callers 3

FinishLoadFunction · 0.85
PreloaderUpdateOneItemFunction · 0.85
DoPreloaderUpdateOneReqFunction · 0.85

Calls 2

UnmarkPathInProgressFunction · 0.85
CreateResourceFunction · 0.70

Tested by

no test coverage detected