| 101 | } |
| 102 | |
| 103 | void ShaderCache::store(const SkData& key, const SkData& data) { |
| 104 | auto dataResult = skDataToByteView(data); |
| 105 | auto ownedKeyResult = skDataToByteView(key); |
| 106 | |
| 107 | if (!dataResult || !ownedKeyResult) { |
| 108 | VALDI_WARN(_logger, "Failed to copy data for shader store"); |
| 109 | return; |
| 110 | } |
| 111 | auto dataByteView = dataResult.moveValue(); |
| 112 | auto keyByteView = ownedKeyResult.moveValue(); |
| 113 | |
| 114 | auto weakThis = weakRef(this); |
| 115 | _queue->async([weakThis, dataByteView, keyByteView]() { |
| 116 | auto strongThis = weakThis.lock(); |
| 117 | if (strongThis) { |
| 118 | strongThis->storeShaderToDisk(keyByteView, dataByteView); |
| 119 | } |
| 120 | }); |
| 121 | } |
| 122 | |
| 123 | sk_sp<SkData> ShaderCache::load(const SkData& key) { |
| 124 | auto keyByteViewUnowned = Valdi::BytesView(nullptr, static_cast<const Byte*>(key.data()), key.size()); |
nothing calls this directly
no test coverage detected