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

Method flush

valdi/src/valdi/runtime/Views/DeferredViewTransaction.cpp:23–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21DeferredViewTransaction::~DeferredViewTransaction() = default;
22
23void 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
46void DeferredViewTransaction::enqueue(DeferredViewTransactionOperation&& operation) {
47 _operations.emplace_back(std::move(operation));

Callers

nothing calls this directly

Calls 5

dispatchSyncMethod · 0.80
flushMethod · 0.65
emptyMethod · 0.45
createViewTransactionMethod · 0.45
dispatchMethod · 0.45

Tested by

no test coverage detected