Merge "Redesign implementation of RegisterNativeAllocation."