| 86 | } |
| 87 | |
| 88 | ShaderCache::ShaderCache(const Ref<IDiskCache>& diskCache, const Ref<DispatchQueue>& dispatchQueue, ILogger& logger) |
| 89 | : _logger(logger), |
| 90 | _queue(dispatchQueue), |
| 91 | _diskCache(diskCache->scopedCache(Path(fmt::format("{}", kShaderCacheVersion)), false)) { |
| 92 | _queue->async([diskCache, scopedDiskCache = _diskCache]() { |
| 93 | auto rootPath = diskCache->getRootPath(); |
| 94 | auto currRootPath = scopedDiskCache->getRootPath(); |
| 95 | for (const auto& folder : diskCache->list(rootPath)) { |
| 96 | if (folder != currRootPath) { |
| 97 | diskCache->remove(folder); |
| 98 | } |
| 99 | } |
| 100 | }); |
| 101 | } |
| 102 | |
| 103 | void ShaderCache::store(const SkData& key, const SkData& data) { |
| 104 | auto dataResult = skDataToByteView(data); |
nothing calls this directly
no test coverage detected