Only supports removing the first child, which is all the preloader uses anyway.
| 406 | |
| 407 | // Only supports removing the first child, which is all the preloader uses anyway. |
| 408 | static void PreloaderRemoveLeaf(ResourcePreloader* preloader, TRequestIndex index) |
| 409 | { |
| 410 | assert(preloader->m_FreelistSize < MAX_PRELOADER_REQUESTS); |
| 411 | |
| 412 | PreloadRequest* me = &preloader->m_Request[index]; |
| 413 | assert(me->m_FirstChild == -1); |
| 414 | assert(me->m_PendingChildCount == 0); |
| 415 | PreloadRequest* parent = &preloader->m_Request[me->m_Parent]; |
| 416 | assert(parent->m_FirstChild == index); |
| 417 | |
| 418 | if (me->m_Resource) |
| 419 | { |
| 420 | if (index < preloader->m_PersistResourceCount) |
| 421 | { |
| 422 | preloader->m_PersistedResources.Push(me->m_Resource); |
| 423 | } |
| 424 | else |
| 425 | { |
| 426 | Release(preloader->m_Factory, me->m_Resource); |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | parent->m_FirstChild = me->m_NextSibling; |
| 431 | |
| 432 | if (me->m_LoadResult == RESULT_PENDING) |
| 433 | { |
| 434 | RemoveFromParentPendingCount(preloader, me); |
| 435 | } |
| 436 | |
| 437 | preloader->m_Freelist[preloader->m_FreelistSize++] = index; |
| 438 | } |
| 439 | |
| 440 | static void RemoveChildren(ResourcePreloader* preloader, PreloadRequest* req) |
| 441 | { |
no test coverage detected