Convert Binder & BinderProxy to NativeAllocationRegistry
Change the Java BinderProxy to only contain a single native pointer, so that we can get by with a single NativeAllocationRegistry registration. This adds some indirections and a new allocation. But it marginally reduces the number of (expensive) JNI field lookups from native code, and the extra allocation involves significantly less overhead than registering each object twice. This also cleans up the code a little by avoiding some explicit reference count adjustments. Change BinderProxy Binder to use NativeAllocationRegistry instead of finalize(). Change the mObject field in Binder to hold a non-reference-counted but owning pointer to JavaBBinderHolder. Have JavaBBinderHolder no longer inherit from RefBase. Make it clear that neither Binder.mObject, not BinderProxy.mNativeData can be null. Remove null checks. Avoid checking for null returns from C++ new. It would throw anyway, which would cause the process to abort. Test: Booted master. Bug: 65760710 Change-Id: I323d4bdc7e25f8c27b847b6fe2c073eac3f2efe5
Loading
Please register or sign in to comment