MCPcopy Create free account
hub / github.com/Snapchat/Valdi / getModuleLoadStrategy

Method getModuleLoadStrategy

valdi/src/valdi/runtime/Resources/Bundle.cpp:272–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270}
271
272Result<Ref<ModuleLoadStrategy>> Bundle::getModuleLoadStrategy() {
273 std::lock_guard<std::recursive_mutex> guard(_mutex);
274 auto resourceContent = getResourceContent(loadStrategyFilePath());
275 if (!resourceContent) {
276 return resourceContent.moveError();
277 }
278
279 auto moduleLoadStragey = castOrNull<ModuleLoadStrategy>(resourceContent.value().processed);
280 if (moduleLoadStragey != nullptr) {
281 return moduleLoadStragey;
282 }
283
284 auto parsed = ModuleLoadStrategy::parse(resourceContent.value().raw.data(), resourceContent.value().raw.size());
285 if (!parsed) {
286 return parsed.moveError();
287 }
288
289 setResourceContent(loadStrategyFilePath(), BundleResourceContent(parsed.value()));
290
291 return parsed.value();
292}
293
294template<typename T>
295void removeUnusedItems(FlatMap<StringBox, T>& items) {

Callers 1

Calls 5

valueMethod · 0.65
parseFunction · 0.50
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected