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

> 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