UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
BackgroundHttpManagerImpl.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "Containers/Array.h"
7#include "Containers/Ticker.h"
10#include "HAL/Platform.h"
14#include "Logging/LogMacros.h"
15#include "Templates/Atomic.h"
16
18
20
26 , public FTSTickerObjectBase
27{
28public:
31
32 BACKGROUNDHTTP_API virtual void AddRequest(const FBackgroundHttpRequestPtr Request) override;
33 BACKGROUNDHTTP_API virtual void RemoveRequest(const FBackgroundHttpRequestPtr Request) override;
34
35 BACKGROUNDHTTP_API virtual void Initialize() override;
36 BACKGROUNDHTTP_API virtual void Shutdown() override;
37
38 BACKGROUNDHTTP_API virtual void DeleteAllTemporaryFiles() override;
39
40 BACKGROUNDHTTP_API virtual int GetMaxActiveDownloads() const override;
42
43
44 BACKGROUNDHTTP_API virtual FString GetTempFileLocationForURL(const FString& URL) override;
45
47 virtual void SetCellularPreference(int32 Value) override {}
48
49 //FTSTickerObjectBase implementation
50 BACKGROUNDHTTP_API virtual bool Tick(float DeltaTime) override;
51
52protected:
54
57
58 //Different from DeleteAllTemporaryFiles as this doesn't delete all files but rather cleans up specific bad files that have gone stale
60
61 //Gets a list of full filenames for all temp files.
63
64 //Helper function that converts the supplied list of Temp folder filenames to a list that is always all full paths.
66
67 //Gather a list of any temp files that have timed out of our BackgroundHTTP settings.
68 //SecondsToConsiderOld should be a double representing how many seconds old a temp file needs to be to be returned by this function
69 //If OptionalFileListToCheck is empty will check all temp files in the backgroundhttp temp file folder. If supplied only the given file paths are checked
71
72 //Gather a list of any temp files that have no corresponding URL Mapping entry
73 //If OptionalFileListToCheck is empty will check all temp files in the backgroundhttp temp file folder. If supplied only the given file paths are checked
75
76 //Gets our FileHashHelper to compute temp file mappings
77 virtual BackgroundHttpFileHashHelperRef GetFileHashHelper(){ return FileHashHelper; }
78 virtual const BackgroundHttpFileHashHelperRef GetFileHashHelper() const { return FileHashHelper; }
79
80protected:
84
88
92
93private:
95};
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_LOG_CATEGORY_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity)
Definition LogMacros.h:361
Definition BackgroundHttpFileHashHelper.h:45
Definition BackgroundHttpManagerImpl.h:27
virtual BACKGROUNDHTTP_API FString GetTempFileLocationForURL(const FString &URL) override
Definition BackgroundHttpManagerImpl.cpp:482
virtual BACKGROUNDHTTP_API void RemoveRequest(const FBackgroundHttpRequestPtr Request) override
Definition BackgroundHttpManagerImpl.cpp:313
virtual BACKGROUNDHTTP_API void SetMaxActiveDownloads(int MaxActiveDownloads) override
Definition BackgroundHttpManagerImpl.cpp:294
virtual BACKGROUNDHTTP_API bool CheckForExistingCompletedDownload(const FBackgroundHttpRequestPtr Request, FString &ExistingFilePathOut, int64 &ExistingFileSizeOut)
Definition BackgroundHttpManagerImpl.cpp:383
virtual BACKGROUNDHTTP_API void Shutdown() override
Definition BackgroundHttpManagerImpl.cpp:54
virtual BACKGROUNDHTTP_API int GetMaxActiveDownloads() const override
Definition BackgroundHttpManagerImpl.cpp:289
virtual void SetCellularPreference(int32 Value) override
Definition BackgroundHttpManagerImpl.h:47
virtual BACKGROUNDHTTP_API void CleanUpDataAfterCompletingRequest(const FBackgroundHttpRequestPtr Request) override
Definition BackgroundHttpManagerImpl.cpp:339
FRWLock ActiveRequestLock
Definition BackgroundHttpManagerImpl.h:87
TAtomic< int > MaxActiveDownloads
Definition BackgroundHttpManagerImpl.h:91
virtual BACKGROUNDHTTP_API void ConvertAllTempFilenamesToFullPaths(TArray< FString > &OutFilenamesAsFullPaths, const TArray< FString > &FilenamesToConvertToFullPaths) const
Definition BackgroundHttpManagerImpl.cpp:254
virtual BACKGROUNDHTTP_API void DeleteAllTemporaryFiles() override
Definition BackgroundHttpManagerImpl.cpp:267
virtual BACKGROUNDHTTP_API void ActivatePendingRequests()
Definition BackgroundHttpManagerImpl.cpp:427
volatile int NumCurrentlyActiveRequests
Definition BackgroundHttpManagerImpl.h:90
virtual BACKGROUNDHTTP_API void AddRequest(const FBackgroundHttpRequestPtr Request) override
Definition BackgroundHttpManagerImpl.cpp:299
virtual BACKGROUNDHTTP_API void DeleteStaleTempFiles()
Definition BackgroundHttpManagerImpl.cpp:70
virtual BACKGROUNDHTTP_API void GatherTempFilesWithoutURLMappings(TArray< FString > &OutTempFilesMissingURLMappings, TArray< FString > *OptionalFileList=nullptr) const
Definition BackgroundHttpManagerImpl.cpp:206
TArray< FBackgroundHttpRequestPtr > ActiveRequests
Definition BackgroundHttpManagerImpl.h:86
virtual BackgroundHttpFileHashHelperRef GetFileHashHelper()
Definition BackgroundHttpManagerImpl.h:77
FRWLock PendingRequestLock
Definition BackgroundHttpManagerImpl.h:83
virtual BACKGROUNDHTTP_API ~FBackgroundHttpManagerImpl()
Definition BackgroundHttpManagerImpl.cpp:37
virtual BACKGROUNDHTTP_API void GatherAllTempFilenames(TArray< FString > &OutAllTempFilenames, bool bOutputAsFullPaths=false) const
Definition BackgroundHttpManagerImpl.cpp:231
virtual BACKGROUNDHTTP_API void Initialize() override
Definition BackgroundHttpManagerImpl.cpp:41
virtual const BackgroundHttpFileHashHelperRef GetFileHashHelper() const
Definition BackgroundHttpManagerImpl.h:78
virtual BACKGROUNDHTTP_API void GatherTempFilesOlderThen(TArray< FString > &OutTimedOutTempFilenames, double SecondsToConsiderOld, TArray< FString > *OptionalFileList=nullptr) const
Definition BackgroundHttpManagerImpl.cpp:167
TArray< FBackgroundHttpRequestPtr > PendingStartRequests
Definition BackgroundHttpManagerImpl.h:82
BACKGROUNDHTTP_API FBackgroundHttpManagerImpl()
Definition BackgroundHttpManagerImpl.cpp:26
virtual BACKGROUNDHTTP_API bool AssociateWithAnyExistingRequest(const FBackgroundHttpRequestPtr Request) override
Definition BackgroundHttpManagerImpl.cpp:350
Definition Ticker.h:137
Definition IBackgroundHttpManager.h:10
Definition Array.h:670
Definition Atomic.h:538
Definition SharedPointer.h:692
Definition CriticalSection.h:14