Files
UnrealEngineUWP/Engine/Source/Runtime/PakFile/Private/FilePackageStore.h
dave belanger b1529d572c Update FFilePackageStore::UncookedPackagesMap when unmounting content
#rb CarlMagnus.Nordin
#preflight 627ac0edc42338be6529f15b

#ROBOMERGE-AUTHOR: dave.belanger
#ROBOMERGE-SOURCE: CL 20138464 via CL 20139528 via CL 20139778 via CL 20140092
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)

[CL 20143828 by dave belanger in ue5-main branch]
2022-05-11 13:16:30 -04:00

76 lines
2.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "IO/PackageId.h"
#include "IO/PackageStore.h"
#include "Misc/PackagePath.h"
struct FIoContainerHeader;
struct FFilePackageStoreEntry;
/*
* File/container based package store.
*/
class FFilePackageStore
: public FPackageStoreBase
{
public:
FFilePackageStore();
virtual ~FFilePackageStore();
virtual void Initialize() override;
virtual void Lock() override;
virtual void Unlock() override;
virtual bool DoesPackageExist(FPackageId PackageId) override;
virtual EPackageStoreEntryStatus GetPackageStoreEntry(FPackageId PackageId, FPackageStoreEntry& OutPackageStoreEntry) override;
virtual bool GetPackageRedirectInfo(FPackageId PackageId, FName& OutSourcePackageName, FPackageId& OutRedirectedToPackageId) override;
void Mount(const FIoContainerHeader* ContainerHeader, uint32 Order);
void Unmount(const FIoContainerHeader* ContainerHeader);
private:
struct FMountedContainer
{
const FIoContainerHeader* ContainerHeader;
uint32 Order;
uint32 Sequence;
};
#if WITH_EDITOR
struct FUncookedPackage
{
FName PackageName;
EPackageExtension HeaderExtension;
};
#endif //if WITH_EDITOR
void Update();
#if WITH_EDITOR
uint64 AddUncookedPackagesFromRoot(const FString& RootPath);
uint64 RemoveUncookedPackagesFromRoot(const TSet<FString>& RootPath);
#endif //if WITH_EDITOR
FRWLock EntriesLock;
FCriticalSection UpdateLock;
TArray<FMountedContainer> MountedContainers;
TAtomic<uint32> NextSequence{ 0 };
TMap<FPackageId, const FFilePackageStoreEntry*> StoreEntriesMap;
TMap<FPackageId, TTuple<FName, FPackageId>> RedirectsPackageMap;
TMap<FPackageId, FName> LocalizedPackages;
bool bNeedsUpdate = false;
#if WITH_EDITOR
FDelegateHandle OnContentPathMountedDelegateHandle;
FDelegateHandle OnContentPathDismountedDelegateHandle;
FCriticalSection UncookedPackageRootsLock;
TSet<FString> PendingAddUncookedPackageRoots;
TSet<FString> PendingRemoveUncookedPackageRoots;
TMap<FPackageId, FUncookedPackage> UncookedPackagesMap;
TMap<FPackageId, const FFilePackageStoreEntry*> OptionalSegmentStoreEntriesMap;
#endif //if WITH_EDITOR
static thread_local int32 LockedOnThreadCount;
};