summaryrefslogtreecommitdiff
path: root/view/sharedcache/core/SharedCacheView.cpp
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-04-07 21:01:22 -0400
committerMason Reed <mason@vector35.com>2025-04-07 21:11:17 -0400
commit633516160e7c752941eaf058109a8859ad9495ef (patch)
treeb17120ebcf0cb421048982a4c980c207c033eb6f /view/sharedcache/core/SharedCacheView.cpp
parentf3f43af65e86b6b9b8a40b33a694efa1779616fe (diff)
[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).
Diffstat (limited to 'view/sharedcache/core/SharedCacheView.cpp')
-rw-r--r--view/sharedcache/core/SharedCacheView.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/view/sharedcache/core/SharedCacheView.cpp b/view/sharedcache/core/SharedCacheView.cpp
index 4ba44cc7..14a1670c 100644
--- a/view/sharedcache/core/SharedCacheView.cpp
+++ b/view/sharedcache/core/SharedCacheView.cpp
@@ -777,6 +777,16 @@ bool SharedCacheView::Init()
DefineAutoSymbolAndVariableOrFunction(
GetDefaultPlatform(), new Symbol(DataSymbol, "primary_cache_header", primaryBase), headerType.type);
+ if (GetFile()->GetFilename().empty())
+ {
+ // We have initialized the view with no backing file.
+ // We are going to forgo initialization of shared cache controller, as there is no way to populate entries.
+ // This can occur when downloading shared cache files from a remote project. In the collaboration core it will
+ // call view init to push metadata about the remote IIRC.
+ LogInfo("No backing file, skipping shared cache controller initialization...");
+ return true;
+ }
+
auto sharedCache = SharedCache(GetAddressSize());
{