From 695368ffae65d72655f70e25d04f23ed3e16e541 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 3 Jun 2022 22:29:14 +0000 Subject: Use android::base::function_ref isntead of std::function This removes an allocation from the binder RPC calls. Test: atest binderAllocationLimits Bug: 230625474 Change-Id: I70ebb4e320323149c3c66809f1077cbf332c07ef --- libs/binder/RpcSession.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libs/binder/RpcSession.cpp') diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp index 6ae5357be2..5c35dd0ac1 100644 --- a/libs/binder/RpcSession.cpp +++ b/libs/binder/RpcSession.cpp @@ -615,7 +615,7 @@ status_t RpcSession::initAndAddConnection(unique_fd fd, const std::vectorinterruptableWriteFully(mShutdownTrigger.get(), &headerIov, 1, {}); + server->interruptableWriteFully(mShutdownTrigger.get(), &headerIov, 1, std::nullopt); if (sendHeaderStatus != OK) { ALOGE("Could not write connection header to socket: %s", statusToString(sendHeaderStatus).c_str()); @@ -625,8 +625,8 @@ status_t RpcSession::initAndAddConnection(unique_fd fd, const std::vector 0) { iovec sessionIov{const_cast(static_cast(sessionId.data())), sessionId.size()}; - auto sendSessionIdStatus = - server->interruptableWriteFully(mShutdownTrigger.get(), &sessionIov, 1, {}); + auto sendSessionIdStatus = server->interruptableWriteFully(mShutdownTrigger.get(), + &sessionIov, 1, std::nullopt); if (sendSessionIdStatus != OK) { ALOGE("Could not write session ID ('%s') to socket: %s", base::HexString(sessionId.data(), sessionId.size()).c_str(), -- cgit v1.2.3-59-g8ed1b