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

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

From: Reilly Grant via GitHub <sysbot+gh@w3.org>
Date: Tue, 25 Sep 2018 19:50:40 +0000
To: public-device-apis-log@w3.org
Message-ID: <issue_comment.created-424478161-1537905040-sysbot+gh@w3.org>
> If a Sensor object is eligible for garbage collection, UA must invoke "Deactivate a sensor object". Looking at the implementation of "Deactivate" in chromium, which is defined as [`Deactivate();`](https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/sensor/sensor.cc?type=cs&sq=package:chromium&g=0&l=279). I try to find out where it's called for garbage collection, but searching it in [Chromium CS](https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/sensor/sensor.cc?type=cs&sq=package:chromium&g=0&l=279), only following three situations call `Deactivate()`.
> 
> * `HandleError`  //when error occurs
> * `ContextDestroyed`   //when current context is destroyed
> * `stop()`  //when stop() invokes
> 
> Seems Chromium did not implement the garbage collection, @rakuco, could you please confirm this?

To clarify Chromium's behavior it is the Sensor::HasPendingActivity() method that controls whether or not the object is eligible for garbage collection. It is eligible if it is in the `kIdle` state (which means that either `stop()` has been called or an `error` event has been signaled) or if there are no active event listeners.

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

This archive was generated by hypermail 2.3.1 : Tuesday, 25 September 2018 19:50:43 UTC