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

Method getCSSDocument

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

Source from the content-addressed store, hash-verified

238}
239
240Result<Ref<CSSDocument>> Bundle::getCSSDocument(const StringBox& path, AttributeIds& attributeIds) {
241 std::lock_guard<std::recursive_mutex> guard(_mutex);
242
243 const auto& it = _cssDocumentByPath.find(path);
244 if (it != _cssDocumentByPath.end()) {
245 return it->second;
246 }
247
248 auto entryResult = getEntry(path);
249 if (!entryResult) {
250 return entryResult.moveError();
251 }
252
253 auto entry = entryResult.moveValue();
254
255 auto documentResult = CSSDocument::parse(ResourceId(_name, path), entry.data(), entry.size(), attributeIds);
256 if (documentResult) {
257 _cssDocumentByPath[path] = documentResult.value();
258 }
259
260 return documentResult;
261}
262
263void Bundle::setCSSDocument(const StringBox& path, const Ref<CSSDocument>& cssDocument) {
264 std::lock_guard<std::recursive_mutex> guard(_mutex);

Callers 1

resolveMethod · 0.45

Calls 7

ResourceIdClass · 0.85
endMethod · 0.65
valueMethod · 0.65
parseFunction · 0.50
findMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected