| 711 | auto context = _contextManager.getContext(contextId); |
| 712 | if (context == nullptr) { |
| 713 | VALDI_WARN(*_logger, "Cannot call action: Context {} was already destroyed.", contextId); |
| 714 | return; |
| 715 | } |
| 716 | auto viewNodeTree = _viewNodeManager.getViewNodeTreeForContextId(context->getContextId()); |
| 717 | if (viewNodeTree == nullptr) { |
| 718 | VALDI_WARN(*_logger, "Cannot call action: no ViewNodeTree associated with context {}", context->getContextId()); |
| 719 | return; |
| 720 | } |
| 721 | |
| 722 | context->getViewManagerContext()->getViewManager().callAction(viewNodeTree.get(), actionName, parameters); |
| 723 | } |
| 724 | |
| 725 | void Runtime::resolveViewNodeTree(const SharedContext& context, |
| 726 | bool inMainThread, |
| 727 | bool createIfNeeded, |
| 728 | Function<void(const SharedViewNodeTree&)>&& function) { |
| 729 | Ref<ViewNodeTree> viewNodeTree; |
| 730 | if (createIfNeeded) { |
| 731 | viewNodeTree = |
| 732 | _viewNodeManager.getOrCreateViewNodeTreeForContext(context, ViewNodeTreeThreadAffinity::MAIN_THREAD); |
| 733 | } else { |
| 734 | viewNodeTree = _viewNodeManager.getViewNodeTreeForContextId(context->getContextId()); |
| 735 | } |
| 736 | |
| 737 | DispatchFunction dispatchFn = [viewNodeTree, function = std::move(function)]() { |
| 738 | auto lock = viewNodeTree != nullptr ? viewNodeTree->lock() : TrackedLock(); |
no test coverage detected