Back out "Revert D23494065: Refactor CallbackManager as a friend class of RecordFunction." (#44699)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/44699
Original commit changeset: 3b1ec928e3db
Previous revert (D23698861) was on the wrong diff stack. Backing out the revert.
Test Plan: Passed unit tests and previously landed.
Reviewed By: mruberry
Differential Revision: D23702258
fbshipit-source-id: 5c3e197bca412f454db5a7e86251ec85faf621c1