class WakeLeaseProvider
Defined at line 243 of file ../../sdk/lib/driver/power/cpp/wake-lease.h
This class is **not** threadsafe! `WakeLeaseProvider` and
`WakeLease` pointers returned from `StartOperation` must be used
on the same thread!
Provides shared pointers to `WakeLeases` which are effectively
fdf_power::WakeLease objects. This provides RAII semantics to manage the
lifecycle of the underlying wake lease such that for a given
`WakeLeaseProvider` there is _at_ _most_ one WakeLease in
existence at any moment. It is worth noting that WakeLease only acquires a
wake lease from the system if the system starts to suspend while the
WakeLease is held.
Using `WakeLeaseProvider` can have performance advantages over
using a WakeLease directly because the provider monitors system state
over its lifetime, allowing it to avoid certain operations vs a series of
shorter-lived `WakeLease` instances which would each only observe system
state while they exist.
The main difference between the shared pointer to a `WakeLease`
from `WakeLeaseProvider` and an `ManualWakeLease` is that with
`WakeLease` we get long-lived system state monitoring and
ergonomic RAII management of the actual lease. With `ManualWakeLease` you
can get long-lived system state monitoring with `End` calls and sacrifice
RAII ergonomics **or** get RAII ergonomics, but lose system state knowledge
after the `ManualWakeLease` is destroyed.
Public Methods
void WakeLeaseProvider (async_dispatcher_t * dispatcher, std::string_view name, fidl::ClientEnd<fuchsia_power_system::ActivityGovernor> sag, bool ignore_system_state, inspect::Node * parent_node, bool log)
See comment in ManualWakeLease::Start
Defined at line 246 of file ../../sdk/lib/driver/power/cpp/wake-lease.h
std::shared_ptr<WakeLease> StartOperation ()
Defined at line 253 of file ../../sdk/lib/driver/power/cpp/wake-lease.h