Changed the AssetManager DispatchEvents function to continously pump the (#4432)

AssetBus of queued functions until empty.

This replicates the old behavior of the EBusQueuePolicy::Execute
function that would continue to execute functions if new ones were added
during the execution of the current queue.

Split the TestFixture class from the AssetHandler and EBus handler for the DynamicSliceInstanceSpawnerTests and
PrefabInstanceSpawnerTest.
This avoids the AssetMananager destructor from deleting the test fixture
if the call to UnregisterHandler is ever removed. This also allows the
memory allocators to get online earlier.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
This commit is contained in:
lumberyard-employee-dm
2021-10-01 12:11:55 -05:00
committed by GitHub
parent 23322edde7
commit 18b947fd00
4 changed files with 180 additions and 138 deletions
@@ -551,8 +551,6 @@ namespace AZ
{
PrepareShutDown();
DispatchEvents();
// Acquire the asset lock to make sure nobody else is trying to do anything fancy with assets
AZStd::scoped_lock<AZStd::recursive_mutex> assetLock(m_assetMutex);
@@ -575,7 +573,10 @@ namespace AZ
{
AZ_PROFILE_FUNCTION(AzCore);
AssetManagerNotificationBus::Broadcast(&AssetManagerNotificationBus::Events::OnAssetEventsDispatchBegin);
AssetBus::ExecuteQueuedEvents();
while (AssetBus::QueuedEventCount())
{
AssetBus::ExecuteQueuedEvents();
}
AssetManagerNotificationBus::Broadcast(&AssetManagerNotificationBus::Events::OnAssetEventsDispatchEnd);
}