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

Method resolveLocalAssetURL

valdi/src/valdi/android/ResourceLoader.cpp:97–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95
96#ifdef __ANDROID__
97 auto* asset = AAssetManager_open(_assetManager, module.getCStr(), AASSET_MODE_BUFFER);
98 if (asset == nullptr) {
99 return Valdi::Error("Unable to open asset");
100 }
101 auto managedAsset = Valdi::makeShared<ManagedAsset>(asset);
102
103 const auto* buffer = AAsset_getBuffer(asset);
104 auto length = AAsset_getLength(asset);
105
106 return Valdi::BytesView(managedAsset, reinterpret_cast<const Valdi::Byte*>(buffer), static_cast<size_t>(length));
107#else
108 return Valdi::Error("Not implemented");
109#endif
110}
111
112std::optional<Valdi::ModuleContentIdentity> ResourceLoader::getModuleIdentity(const Valdi::StringBox& module) {
113 if (_shouldDeferModuleLoadToJava) {
114 // Java may serve the module from elsewhere (dynamic delivery), so it is asked first, as in

Callers 2

Calls 9

toJavaObjectFunction · 0.85
toValueFunction · 0.85
toObjectMethod · 0.80
stealLocalRefMethod · 0.80
callMethod · 0.65
JavaEnvClass · 0.50
StringBoxClass · 0.50
isStringMethod · 0.45
toStringBoxMethod · 0.45

Tested by

no test coverage detected