[wpt-sync] Sync PR 46671 - compute pressure: Track client state in PressureObserverManager, rework PressureClientImpl::Reset()
Categories
(Testing :: web-platform-tests, task, P4)
Tracking
(Not tracked)
People
(Reporter: wpt-sync, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Sync web-platform-tests PR 46671 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/46671
Details from upstream follow.
Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> wrote:
compute pressure: Track client state in PressureObserverManager, rework PressureClientImpl::Reset()
This solves two issues:
A design issue. PressureClientImpl::State represented a concept that
only made sense in PressureObserverManager's context, so it should be
tracked there.
The different states concern whether WebPressureManager.AddClient()
has been called for a given source type and whether it has finished
running.A bug. PressureClientImpl::Reset() was too eager and cleared too many
variables:
- Clearing |observers_| means PressureObserver instances would be
left dangling and never receive any updates even if the given
PressureClientImpl ended up connecting to the browser process.- Resetting |state_| caused PressureObserverManager::DidAddClient()
to exit early in case the AddClient() handler in the browser
process reset or dropped the pending PressureClient remote before
sending back a PressureStatus.
In this case, existing PressureObserver instances would never be
notified and any pending promises would never be fulfilled or
rejected.Change-Id: Ia671bdbeb8067cb518111810a3281eaab1abdd1d
Reviewed-on: https://chromium-review.googlesource.com/5611240
WPT-Export-Revision: 51a886aeae3d8ac19377a4f4654076238c986d85
Description
•