CHDLCHookManager
Tracking Issue: #212
The CHDLCHookManager class is an internal component of CHL that allows us to retrieve only DLCs (X2DownloadableContentInfo classes) that override a specific function or event by method name.
It was introduced to optimize the number of calls made on X2DownloadableContentInfo classes. Instead of CHL calling X2DLCI methods on every known DLC class (which can grow large), it uses `DLCHOOKMGR.GetDLCInfos('MethodName') to fetch only the DLCs that actually override a method with that name. Any base classes (except X2DownloadableContentInfo itself) that override a method with that name are also returned.
One very noticeable example is the UpdateHumanPawnMeshComponent/Material hook. UpdateHumanPawnMeshComponent has a default implementation that always loops through the materials of the mesh component, performs some type checking, and then forwards the call to the UpdateHumanPawnMeshMaterial method for backward compatibility, which has an empty default implementation.
The unfortunate side effect of this, with large mod lists and calling UpdateHumanPawnMeshComponent on all DLC classes, is that it does a lot of work for nothing. Moreover, this method is actually called twice in a single frame due to the logic of XGunitNativeBase.ResetWeaponsToDefaultSockets, amplifying the effect even further.
Profiling using a large mod list has shown significantly reduced frame times in places where these methods were called, especially the ones which have a default implementation.
Special care must be taken by CHL developers when making changes to the X2DownloadableContentInfo class, as they might need supporting changes to the CHDLCHookManager class. This is especially important when introducing new versions of existing hooks; follow the comments in the source of CHDLCHookManager.uc