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

Method runUpdatesInner

valdi/src/valdi/runtime/Context/ViewNodeTree.cpp:744–820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 14

beginPauseUpdatesMethod · 0.80
frontMethod · 0.80
slowToStringMethod · 0.80
flushUpdatesMethod · 0.80
endPauseUpdatesMethod · 0.80
toStringMethod · 0.65
nowFunction · 0.50
has_valueMethod · 0.45
getAssetsManagerMethod · 0.45
emptyMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected