status_t TransactionCallbackInvoker::findTransactionStats(
const sp<IBinder>& listener, const std::vector<CallbackId>& callbackIds,
TransactionStats** outTransactionStats) {
auto& transactionStatsDeque = mCompletedTransactions[listener];
// Search back to front because the most recent transactions are at the back of the deque
auto itr = transactionStatsDeque.rbegin();
for (; itr != transactionStatsDeque.rend(); itr++) {
if (compareCallbackIds(itr->callbackIds, callbackIds) == 0) {
*outTransactionStats = &(*itr);
return NO_ERROR;
}
}
ALOGE("could not find transaction stats");
return BAD_VALUE;
}
- 从
mCompletedTransactions
根据 listener
返回 TransactionStats 队列 transactionStatsDeque
。
- 遍历
transactionStatsDeque
调用 compareCallbackIds()
判断是否相同。如果相同,设置 outTransactionStats
返回 NO_ERROR
。