summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/TransactionCallbackInvoker.cpp
diff options
context:
space:
mode:
author Alec Mouri <alecmouri@google.com> 2022-05-18 18:03:19 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-05-18 18:03:19 +0000
commit38332d524c3f695d3fdd8fd9fbda117d0e97b2c0 (patch)
treee7bc79fc9034bffa460bf17e68ad8979acf10fce /services/surfaceflinger/TransactionCallbackInvoker.cpp
parent8ffb0288806aa7f41ff1b6f6ad9321980f955907 (diff)
parent8d7d0f42c697ad893df9249b6e66684adb9439f5 (diff)
Merge "Use semaphore instead of condition variable" into tm-dev
Diffstat (limited to 'services/surfaceflinger/TransactionCallbackInvoker.cpp')
-rw-r--r--services/surfaceflinger/TransactionCallbackInvoker.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/services/surfaceflinger/TransactionCallbackInvoker.cpp b/services/surfaceflinger/TransactionCallbackInvoker.cpp
index fa8cffc32a..d2c2e29a2f 100644
--- a/services/surfaceflinger/TransactionCallbackInvoker.cpp
+++ b/services/surfaceflinger/TransactionCallbackInvoker.cpp
@@ -185,6 +185,7 @@ void TransactionCallbackInvoker::addPresentFence(const sp<Fence>& presentFence)
void TransactionCallbackInvoker::sendCallbacks(bool onCommitOnly) {
// For each listener
auto completedTransactionsItr = mCompletedTransactions.begin();
+ BackgroundExecutor::Callbacks callbacks;
while (completedTransactionsItr != mCompletedTransactions.end()) {
auto& [listener, transactionStatsDeque] = *completedTransactionsItr;
ListenerStats listenerStats;
@@ -219,7 +220,7 @@ void TransactionCallbackInvoker::sendCallbacks(bool onCommitOnly) {
// keep it as an IBinder due to consistency reasons: if we
// interface_cast at the IPC boundary when reading a Parcel,
// we get pointers that compare unequal in the SF process.
- BackgroundExecutor::getInstance().execute([stats = std::move(listenerStats)]() {
+ callbacks.emplace_back([stats = std::move(listenerStats)]() {
interface_cast<ITransactionCompletedListener>(stats.listener)
->onTransactionCompleted(stats);
});
@@ -231,6 +232,8 @@ void TransactionCallbackInvoker::sendCallbacks(bool onCommitOnly) {
if (mPresentFence) {
mPresentFence.clear();
}
+
+ BackgroundExecutor::getInstance().sendCallbacks(std::move(callbacks));
}
// -----------------------------------------------------------------------