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

Method destroyContext

valdi/src/valdi/runtime/Runtime.cpp:316–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314 return _viewNodeManager.getOrCreateViewNodeTreeForContext(context, ViewNodeTreeThreadAffinity::MAIN_THREAD);
315}
316
317void Runtime::destroyContext(const SharedContext& context) {
318 // Destroying the context will release the Runtime ref.
319 // If the Context is the last one holding a reference on the Runtime,
320 // we want to make sure the Runtime will stay alive until
321 // this function is called.
322 auto strongRef = Valdi::strongRef(this);
323
324 if (_mainThreadManager->currentThreadIsMainThread()) {
325 doDestroyContext(context);
326 } else {
327 _mainThreadManager->dispatch(context, [=]() { strongRef->doDestroyContext(context); });
328 }
329}
330
331void Runtime::doDestroyContext(const SharedContext& context) {

Callers

nothing calls this directly

Calls 4

strongRefFunction · 0.85
doDestroyContextMethod · 0.80
dispatchMethod · 0.45

Tested by

no test coverage detected