| 238 | } |
| 239 | |
| 240 | Result<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 | |
| 263 | void Bundle::setCSSDocument(const StringBox& path, const Ref<CSSDocument>& cssDocument) { |
| 264 | std::lock_guard<std::recursive_mutex> guard(_mutex); |