// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "InstallBundleSourcePlatformBase.h" #if WITH_PLATFORM_INSTALL_BUNDLE_SOURCE #include "Containers/StaticArray.h" #include "Containers/Ticker.h" #include "GenericPlatform/GenericPlatformChunkInstall.h" class FInstallBundleSourcePlatformChunkInstall : public FInstallBundleSourcePlatformBase { private: // Internal Types struct FBundleInfo { public: EInstallBundlePriority Priority = EInstallBundlePriority::Low; FName NamedChunk; TArray FilePaths; }; class FContentRequest { public: FName BundleName; ELogVerbosity::Type LogVerbosityOverride = ELogVerbosity::NoLogging; bool bInProgress = true; bool bCancelled = false; TArray ContentPaths; FInstallBundleCompleteDelegate CompleteCallback; }; using FContentRequestRef = TSharedRef; using FContentRequestPtr = TSharedPtr; using FContentRequestWeakPtr = TWeakPtr; class FContentReleaseRequest { public: FName BundleName; ELogVerbosity::Type LogVerbosityOverride = ELogVerbosity::NoLogging; bool bInProgress = true; bool bFailed = false; FInstallBundleRemovedDelegate CompleteCallback; }; using FContentReleaseRequestRef = TSharedRef; using FContentReleaseRequestPtr = TSharedPtr; using FContentReleaseRequestWeakPtr = TWeakPtr; public: DEFAULTINSTALLBUNDLEMANAGER_API FInstallBundleSourcePlatformChunkInstall( IPlatformChunkInstall* InPlatformChunkInstall); FInstallBundleSourcePlatformChunkInstall(const FInstallBundleSourcePlatformChunkInstall& Other) = delete; FInstallBundleSourcePlatformChunkInstall& operator=(const FInstallBundleSourcePlatformChunkInstall& Other) = delete; DEFAULTINSTALLBUNDLEMANAGER_API virtual ~FInstallBundleSourcePlatformChunkInstall(); private: DEFAULTINSTALLBUNDLEMANAGER_API bool Tick(float dt); DEFAULTINSTALLBUNDLEMANAGER_API void TickUpdateChunkOrder(); // IInstallBundleSource Interface public: DEFAULTINSTALLBUNDLEMANAGER_API virtual FInstallBundleSourceInitInfo Init( TSharedRef InRequestStats, TSharedPtr AnalyticsProvider, TSharedPtr InPersistentStatsContainer) override; DEFAULTINSTALLBUNDLEMANAGER_API virtual void AsyncInit(FInstallBundleSourceInitDelegate Callback) override; DEFAULTINSTALLBUNDLEMANAGER_API virtual void GetContentState(TArrayView BundleNames, EInstallBundleGetContentStateFlags Flags, FInstallBundleGetContentStateDelegate Callback) override; DEFAULTINSTALLBUNDLEMANAGER_API virtual EInstallBundleSourceBundleSkipReason GetBundleSkipReason(FName BundleName) const override; DEFAULTINSTALLBUNDLEMANAGER_API virtual void RequestUpdateContent(FRequestUpdateContentBundleContext Context) override; DEFAULTINSTALLBUNDLEMANAGER_API virtual void RequestReleaseContent(FRequestReleaseContentBundleContext BundleContext) override; DEFAULTINSTALLBUNDLEMANAGER_API virtual void CancelBundles(TArrayView BundleNames) override; DEFAULTINSTALLBUNDLEMANAGER_API virtual TOptional GetBundleProgress(FName BundleName) const override; protected: DEFAULTINSTALLBUNDLEMANAGER_API virtual bool QueryPersistentBundleInfo(FInstallBundleSourcePersistentBundleInfo& SourceBundleInfo) const override; DEFAULTINSTALLBUNDLEMANAGER_API void OnNamedChunkInstall(const FNamedChunkCompleteCallbackParam& Param); DEFAULTINSTALLBUNDLEMANAGER_API FName GetNamedChunkForBundle(FName BundleName) const; private: FTSTicker::FDelegateHandle TickHandle; FDelegateHandle NamedChunkInstallDelegateHandle; TMap BundleInfoMap; TSet NamedChunks; TArray ContentRequests; TArray ContentReleaseRequests; TArray> GeneralAsyncTasks; IPlatformChunkInstall* PlatformChunkInstall; bool bChunkOrderDirty = false; bool bIsUpdatingChunkOrder = false; }; #endif //WITH_PLATFORM_INSTALL_BUNDLE_SOURCE