w3c / compute-pressure

A web API proposal that provides information about available compute capacity
https://www.w3.org/TR/compute-pressure/
Other
69 stars 10 forks source link

"Valid source type" check in PressureObserver.observe() needs more details #273

Open rakuco opened 4 months ago

rakuco commented 4 months ago

The current text says:

If source is not a valid source type, queue a global task on the PressureObserver task source given relevantGlobal to reject promise NotSupportedError and abort these steps.

It is not very clear how to determine whether a given source type is valid or not: https://w3c.github.io/compute-pressure/#dfn-valid-source-types just says "global system thermals" and "central processing unit" (as represented in PressureSource) are the valid source types, but the check in observe() is really for whether a source type is supported by the underlying platform/hardware rather than being "valid" from a spec sense.

I think observe() should use some different concept that better represents what it is trying to do, which could also integrate more nicely with the automation steps (since a virtual pressure source could be configured to report itself as non-existent).