[Fuchsia] Add helper for the Modular Lifecycle protocol.

Components (including Runners, Agents and mods) have their lifecycle
controlled by the framework via a Lifecycle protocol, which provides
APIs to request graceful teardown.

We provide a LifecycleImpl helper implementing the Modular Lifecycle
protocol, which runs a caller-supplied |on_terminate| closure when
Lifecycle::Terminate() is called.

Bug: 852145, 931337
Change-Id: Ib323384383987a8d02aacc9632e25415f1df3400
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1497858
Reviewed-by: Kevin Marshall <kmarshall@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#639070}
5 files changed