W3C home > Mailing lists > Public > public-device-apis-log@w3.org > September 2018

Re: [sensors] Garbage collection behavior unclear in Generic Sensor spec

From: Raphael Kubo da Costa via GitHub <sysbot+gh@w3.org>
Date: Tue, 25 Sep 2018 08:20:17 +0000
To: public-device-apis-log@w3.org
Message-ID: <issue_comment.created-424250062-1537863616-sysbot+gh@w3.org>
> If I understand the comments above, the intent is perhaps simply the following:
> > When an Sensor object in the active state is garbage collected, it must invoke deactivate a sensor object with this object as the argument.

That's correct. I'll try to reword this bit a little to clarify the intent here.

> A consequence of this behavior is that an active sensor object without `onreading` or `onerror` callbacks remains connected to the platform sensor until it is garbage collected. The script should call `stop`. Otherwise the connection to the platform sensor remains active until it is collected, consuming some resources unnecessarily for a non-deterministic period of time.

Sorry, it's not clear to me if you're suggesting a change or just thinking out loud :-) Yes, if one calls `start()` and the sensor's activated without one or more event handlers, it'll remain active until it's GCed (and consequently deactivated in the process of being GCed). The only difference between `stop()` and sensor deactivation is that the former also sets the sensor's state to "idle", which should be irrelevant when the sensor's being deactivated anyway, so the above's kind of already happening.

GitHub Notification of comment by rakuco
Please view or discuss this issue at https://github.com/w3c/sensors/issues/372#issuecomment-424250062 using your GitHub account
Received on Tuesday, 25 September 2018 08:20:19 UTC

This archive was generated by hypermail 2.4.0 : Monday, 4 July 2022 12:47:55 UTC