This code was duplicated in two places, one which was unused. This syncs the code and removes the unused version. Upstream-commit: d69a6a20f0b6657821638ee591920d071a784b0e Component: engine