Moves the `Scoped` template (meant for clearing up the references) into separate utils so as to allow for reuse in future. Other portal instances e.g. remote desktop portal will benefit from this later. Bug: chromium:1291247 Change-Id: Ie36415573edcbe4f697cf97b568243f09f26915d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249400 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Mark Foltz <mfoltz@chromium.org> Commit-Queue: Salman Malik <salmanmalik@google.com> Cr-Commit-Position: refs/heads/main@{#35916}