class ShutdownManager
Defined at line 27 of file ../../src/ui/scenic/lib/shutdown/shutdown_manager.h
Framework for managing shutdown activities. All subsystems that require graceful shutdown
register callbacks that are invoked when |Shutdown()| is called. These callbacks return a
promise that is completed when that subsystem is finished shutting down; ShutdownManager waits
for all of these promises before invoking the |quit_callback| passed to the constructor.
NOTE: this is only for shutdown activities that *must* happen asynchronously on a loop. It is
preferable to cleanly using only destructors, if possible.
Public Methods
std::shared_ptr<ShutdownManager> New (async_dispatcher_t * dispatcher, QuitCallback quit_callback, TimeoutCallback timeout_callback)
|dispatcher| is used for all async operations. |quit_callback| is invoked after all registered
clients have finished shutting down. If shutdown cannot be completed before the specified
timeout, |timeout_callback| is invoked instead, from a thread not associated with |dispatcher|.
Defined at line 23 of file ../../src/ui/scenic/lib/shutdown/shutdown_manager.cc
void ~ShutdownManager ()
Defined at line 30 of file ../../src/ui/scenic/lib/shutdown/shutdown_manager.cc
void RegisterClient (ClientCallback client)
Defined at line 49 of file ../../src/ui/scenic/lib/shutdown/shutdown_manager.cc
void Shutdown (zx::duration timeout)
Attempts to shutdown gracefully. If the specified |timeout| is exceeded, then the
|timeout_callback| will be invoked even though some clients aren't finished shutting down.
Only the first call to |Shutdown()| is effective; subsequent calls are ignored.
Defined at line 58 of file ../../src/ui/scenic/lib/shutdown/shutdown_manager.cc
void set_clock_callback (fit::function<zx::time ()> cb)
For testing. NOTE: this callback will be destroyed on a different thread, so be sure not to
capture refs to any non-threadsafe objects.
Defined at line 119 of file ../../src/ui/scenic/lib/shutdown/shutdown_manager.cc