Merge changes from topic "revert-2807644-revert-2780893-XRITMVSTFB-ZYEEKMIRIQ" into main

* changes:
  Revert^2 "Use std::function instead of base::function_ref"
  Revert^2 "Use std::unique_ptr instead of ScopeGuard"