Merge "Revert "Redesign implementation of RegisterNativeAllocation.""