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

Method store

valdi/src/valdi/snap_drawing/Graphics/ShaderCache.cpp:103–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103void 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
123sk_sp<SkData> ShaderCache::load(const SkData& key) {
124 auto keyByteViewUnowned = Valdi::BytesView(nullptr, static_cast<const Byte*>(key.data()), key.size());

Callers

nothing calls this directly

Calls 5

skDataToByteViewFunction · 0.85
weakRefFunction · 0.85
storeShaderToDiskMethod · 0.80
asyncMethod · 0.45
lockMethod · 0.45

Tested by

no test coverage detected