Skip to content

Commit 6335161

Browse files
committed
[SharedCache] Don't process shared cache when view is not file backed
This fixes a case where the remote file is downloaded and the shared cache view is selected, we _only_ work for file backed views, as our shared cache specific file accessors work on those. So this is not a loss in functionality. In the future if we wanted to load shared caches without touching disk (yikes) than we would need to remove this restriction, or provide a way in the API for user to process their own cache entries (after view init).
1 parent f3f43af commit 6335161

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

view/sharedcache/core/SharedCacheView.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,16 @@ bool SharedCacheView::Init()
777777
DefineAutoSymbolAndVariableOrFunction(
778778
GetDefaultPlatform(), new Symbol(DataSymbol, "primary_cache_header", primaryBase), headerType.type);
779779

780+
if (GetFile()->GetFilename().empty())
781+
{
782+
// We have initialized the view with no backing file.
783+
// We are going to forgo initialization of shared cache controller, as there is no way to populate entries.
784+
// This can occur when downloading shared cache files from a remote project. In the collaboration core it will
785+
// call view init to push metadata about the remote IIRC.
786+
LogInfo("No backing file, skipping shared cache controller initialization...");
787+
return true;
788+
}
789+
780790
auto sharedCache = SharedCache(GetAddressSize());
781791

782792
{

0 commit comments

Comments
 (0)