| 21 | DeferredViewTransaction::~DeferredViewTransaction() = default; |
| 22 | |
| 23 | void DeferredViewTransaction::flush(bool sync) { |
| 24 | if (_operations.empty()) { |
| 25 | return; |
| 26 | } |
| 27 | |
| 28 | DispatchFunction dispatchFn = [viewManager = &_viewManager, operations = std::move(_operations)]() { |
| 29 | auto transaction = viewManager->createViewTransaction(nullptr, false); |
| 30 | |
| 31 | for (const auto& operation : operations) { |
| 32 | operation(*transaction); |
| 33 | } |
| 34 | |
| 35 | transaction->flush(/* sync */ false); |
| 36 | }; |
| 37 | |
| 38 | if (sync) { |
| 39 | DropAllTrackedLocks dropAllTrackedLocks; |
| 40 | _mainThreadManager.dispatchSync(_context, std::move(dispatchFn)); |
| 41 | } else { |
| 42 | _mainThreadManager.dispatch(_context, std::move(dispatchFn)); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | void DeferredViewTransaction::enqueue(DeferredViewTransactionOperation&& operation) { |
| 47 | _operations.emplace_back(std::move(operation)); |
nothing calls this directly
no test coverage detected