`ByNameMap` should be locked here.