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

Method warmUpBundles

valdi/src/valdi/runtime/Resources/ResourceManager.cpp:458–478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456 for (const auto& moduleName : strategy->valdiModules) {
457 self->getBundle(moduleName);
458 }
459 });
460}
461
462void ResourceManager::warmUpBundles(const std::vector<StringBox>& modulePaths) {
463 FlatSet<StringBox> seen;
464 std::vector<StringBox> bundles;
465 for (const auto& path : modulePaths) {
466 auto sv = path.toStringView();
467 auto slash = sv.find('/');
468 if (slash != std::string_view::npos) {
469 auto bundleName = StringCache::getGlobal().makeString(sv.substr(0, slash));
470 if (seen.insert(bundleName).second) {
471 bundles.push_back(bundleName);
472 }
473 }
474 }
475
476 _workerQueue->async([self = strongSmallRef(this), bundles = std::move(bundles)]() {
477 VALDI_TRACE("Valdi.warmUpBundles");
478 for (const auto& bundleName : bundles) {
479 self->getBundle(bundleName);
480 }
481 });

Callers 1

preloadModulesMethod · 0.80

Calls 9

getBundleMethod · 0.95
getGlobalFunction · 0.85
strongSmallRefFunction · 0.85
makeStringMethod · 0.80
substrMethod · 0.80
insertMethod · 0.65
toStringViewMethod · 0.45
findMethod · 0.45
asyncMethod · 0.45

Tested by

no test coverage detected