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

Method endPauseUpdates

valdi/src/valdi/runtime/Resources/AssetsManager.cpp:871–898  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

869}
870
871void AssetsManager::endPauseUpdates() {
872 auto guard = lock();
873
874 SC_ASSERT(_pauseUpdatesCount > 0);
875
876 bool isMainThread = _mainThreadManager.currentThreadIsMainThread();
877
878 if (_pauseUpdatesCount == 1 && !_scheduledUpdates.empty() && isMainThread) {
879 performUpdates(std::move(guard));
880 guard = lock();
881 }
882
883 _pauseUpdatesCount--;
884
885 if (_pauseUpdatesCount == 0) {
886 scheduleFlushLoadRequests();
887 if (!_scheduledUpdates.empty()) {
888 if (!isMainThread) {
889 guard.unlock();
890 schedulePerformUpdates();
891 } else {
892 // We had an incoming update that happened while performing updates.
893 // Flush them now
894 performUpdates(std::move(guard));
895 }
896 }
897 }
898}
899
900void AssetsManager::performUpdates(std::unique_lock<std::recursive_mutex>&& lock) {
901 SC_ASSERT(_mainThreadManager.currentThreadIsMainThread());

Callers 2

TESTFunction · 0.80
runUpdatesInnerMethod · 0.80

Calls 3

emptyMethod · 0.45
unlockMethod · 0.45

Tested by 1

TESTFunction · 0.64