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

Method snapshotView

valdi/src/valdi/android/AndroidViewTransaction.cpp:138–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138void AndroidViewTransaction::snapshotView(const Valdi::Ref<Valdi::View>& view,
139 Valdi::Function<void(Valdi::Result<Valdi::BytesView>)> cb) {
140 auto callback = Valdi::makeShared<Valdi::ValueFunctionWithCallable>(
141 [cb = std::move(cb)](const Valdi::ValueFunctionCallContext& callContext) -> Valdi::Value {
142 auto value = callContext.getParameter(0);
143 auto typedArray = value.getTypedArray();
144 cb(typedArray != nullptr ? typedArray->getBuffer() : Valdi::BytesView());
145 return Valdi::Value::undefined();
146 });
147
148 auto callbackAsActionObject = ValdiAndroid::toJavaObject(JavaEnv(), callback);
149 ValdiFunctionType valdiFunction(JavaEnv(), callbackAsActionObject.stealLocalRef());
150 JavaCache::get().getViewRefSnapshotMethod().call(fromValdiView(view), valdiFunction);
151}
152
153void AndroidViewTransaction::flushAnimator(const Valdi::Ref<Valdi::Animator>& animator,
154 const Valdi::Value& completionCallback) {

Callers

nothing calls this directly

Calls 10

toJavaObjectFunction · 0.85
fromValdiViewFunction · 0.85
getParameterMethod · 0.80
stealLocalRefMethod · 0.80
callMethod · 0.65
cbFunction · 0.50
BytesViewClass · 0.50
JavaEnvClass · 0.50
getFunction · 0.50
getTypedArrayMethod · 0.45

Tested by

no test coverage detected