wpt
wpt copied to clipboard
[ComputePressure] Implement PressureObserverManager in Blink
Currently all PressureObservers connect to the PressureServiceImpl directly. As a result, there may be too many Mojo connections and the same PressureState is sent from the Browser to Blink multiple times.
This CL implements PressureObserverManager in Blink to maintain active PressureObservers. The PressureObserverManager connects to the PressureServiceImpl to receive PressureState and broadcasts the PressureState to active observers.
The implementation of registering an active PressureObserver to PressureObserverManager is complicated now, because we need to maintain the quantization scheme correctly. However, we will remove the quantization in the future according to the newest spec [1]. We can simplify the implementation when quantization is removed.
[1] https://wicg.github.io/compute-pressure/#ref-for-dfn-pressure-states-1
Bug: 1311941 Change-Id: I707d70518799c938b98f8a6aaab5177800fb0ee7
Reviewed-on: https://chromium-review.googlesource.com/3771113 WPT-Export-Revision: 83e061613d314893e674e576f5d84639a6ca10ae