| 742 | TrackedLock guard(_mutex, deadline); |
| 743 | if (!guard.owns()) { |
| 744 | return false; |
| 745 | } |
| 746 | ContextEntry contextEntry(_context); |
| 747 | _context->withAttribution([&]() { |
| 748 | auto viewTransationScope = beginViewTransaction(); |
| 749 | fn(); |
| 750 | endViewTransaction(viewTransationScope, /* layoutDidBecomeDirty */ false); |
| 751 | }); |
| 752 | return true; |
| 753 | } |
| 754 | |
| 755 | void ViewNodeTree::runUpdates() { |
| 756 | if (_updateFunctions.empty()) { |
| 757 | return; |
| 758 | } |
| 759 | |
| 760 | _context->withAttribution([&]() { runUpdatesInner(); }); |
| 761 | } |
| 762 | |
| 763 | void ViewNodeTree::runUpdatesInner() { |
| 764 | const auto runUpdatesStart = std::chrono::steady_clock::now(); |
| 765 | if (!_runUpdatesInnerSessionStart.has_value()) { |
| 766 | _runUpdatesInnerSessionStart = runUpdatesStart; |
| 767 | } |
| 768 | |
| 769 | ContextEntry contextEntry(_context); |
| 770 | auto viewTransactionScope = beginViewTransaction(); |
| 771 | |
| 772 | auto layoutDirtyCounter = _layoutDirtyCounter; |
| 773 | _updating = true; |
| 774 | SmallVector<DispatchFunction, 4> completions; |
| 775 | |
| 776 | Ref<AssetsManager> assetsManager; |
| 777 | if (_runtime != nullptr) { |
| 778 | assetsManager = _runtime->getResourceManager().getAssetsManager(); |
| 779 | assetsManager->beginPauseUpdates(); |
| 780 | } |
| 781 | |
| 782 | #if !VALDI_DEBUG_TREE_UPDATES |
| 783 | VALDI_TRACE("Valdi.runTreeUpdates"); |
| 784 | #endif |
| 785 | |
| 786 | while (!_updateFunctions.empty()) { |
| 787 | auto updates = std::move(_updateFunctions.front()); |
| 788 | _updateFunctions.pop_front(); |
| 789 | |
| 790 | #if VALDI_DEBUG_TREE_UPDATES |
| 791 | // Emit trace per update with component name (symbol only) and trigger. |
| 792 | std::string traceSuffix; |
| 793 | if (!_context->getPath().isEmpty()) { |
| 794 | const auto& path = _context->getPath(); |
| 795 | traceSuffix = path.getSymbolName().isEmpty() ? path.toString() : path.getSymbolName().slowToString(); |
| 796 | } |
| 797 | if (!updates.traceTrigger.empty()) { |
| 798 | if (!traceSuffix.empty()) { |
| 799 | traceSuffix += "|"; |
| 800 | } |
| 801 | traceSuffix += updates.traceTrigger; |
nothing calls this directly
no test coverage detected