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

Method load

valdi/test/runtime/AssetsManager_tests.cpp:61–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59 }
60
61 Result<Value> load(const Ref<MainQueue>& mainQueue,
62 const Ref<Asset>& asset,
63 int32_t preferredWidth = 0,
64 int32_t preferredHeight = 0,
65 Value filter = Value(),
66 snap::valdi_core::AssetOutputType outputType = snap::valdi_core::AssetOutputType::Dummy) {
67 asset->addLoadObserver(strongRef(this), outputType, preferredWidth, preferredHeight, filter);
68
69 mainQueue->runUntilTrue([&]() { return !_results.empty(); });
70
71 if (_results.empty()) {
72 return Error("Timed out");
73 }
74
75 return _results[_results.size() - 1];
76 }
77
78 void unload(const Ref<Asset>& asset) {
79 asset->removeLoadObserver(strongRef(this));

Callers

nothing calls this directly

Calls 7

strongRefFunction · 0.85
runUntilTrueMethod · 0.80
addLoadObserverMethod · 0.65
ValueInterface · 0.50
ErrorInterface · 0.50
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected