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

Method snapDrawingSetSurface

valdi/src/valdi/android/NativeBridge.cpp:2202–2220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2200 auto javaEnv = ValdiAndroid::JavaEnv();
2201 auto completionConverted = ValdiAndroid::toValue(javaEnv, ValdiAndroid::JavaEnv::newLocalRef(completion.get()));
2202
2203 if (completionConverted.getFunction() == nullptr) {
2204 ValdiAndroid::throwJavaValdiException(env, "completion should be a function");
2205 return;
2206 }
2207
2208 runtime->getJavaScriptRuntime()->stopProfiling([=](const auto& result) {
2209 Valdi::Value content;
2210 Valdi::Value error;
2211 if (result) {
2212 Valdi::ValueArrayBuilder builder;
2213 for (auto const& item : result.value()) {
2214 builder.append(Valdi::Value(item));
2215 }
2216 content = Valdi::Value(builder.build());
2217 } else {
2218 content = Valdi::Value(Valdi::ValueArray::make(0));
2219 error = Valdi::Value(result.error().toStringBox());
2220 }
2221 (*completionConverted.getFunction())({content, error});
2222 });
2223}

Callers

nothing calls this directly

Calls 2

getSnapDrawingRootFunction · 0.85
setSurfaceMethod · 0.45

Tested by

no test coverage detected