libbinder: oneway calls delay refcounting
For oneway calls, we might be processing many at the same time. We can
avoid sending any decref calls until we finish processing all oneway
transactions. So, for instance, if we send 100 transactions, and they
can all be processed at the same time, we'll only write one response to
update the refcount in the caller process.
Note: this was written to try to fix the deadlock in "libbinder: RPC avoid
poll", but it does not. Still, I think it's a good improvement.
Bug: 182940634
Test: binderRpcTest
Change-Id: Ieb5374127cc79222b09f5efb12436211f609c9bb
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 6644187..6ce0922 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -291,6 +291,9 @@
if (status_t status = mSession->state()->onBinderEntering(mSession, addr, &binder);
status != OK)
return status;
+ if (status_t status = mSession->state()->flushExcessBinderRefs(mSession, addr, binder);
+ status != OK)
+ return status;
}
return finishUnflattenBinder(binder, out);