W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2014

Re: [Gamepad] Liveness of Gamepad objects

From: Florian Bösch <pyalot@gmail.com>
Date: Tue, 29 Apr 2014 21:27:45 +0200
Message-ID: <CAOK8ODgykLfPgk9nnDDxHVwiAU4US83Q2gmw5mLwFpVeK_mmgg@mail.gmail.com>
To: "Mark S. Miller" <erights@google.com>
Cc: Boris Zbarsky <bzbarsky@mit.edu>, Brandon Jones <bajones@google.com>, Brendan Eich <brendan@secure.meer.net>, public-webapps <public-webapps@w3.org>
I think both semantics are workable. I'd likely prefer the gamepad state to
be immutable from JS, because assigning state there is smelly. I'd also
prefer the option that incurs less GC overhead if possible. Beyond that, I
just think the implementations should be semantically and symbolically
identical.


On Tue, Apr 29, 2014 at 9:19 PM, Mark S. Miller <erights@google.com> wrote:

>
>
>
> On Tue, Apr 29, 2014 at 11:07 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>
>> On 4/29/14, 1:46 PM, Mark S. Miller wrote:
>>
>>> How would either make GC observable?
>>>
>>
>> Consider the following code:
>>
>>   navigator.getGamepads()[0].foo = 5;
>>   var intervals = 0;
>>   var id = setInterval(function() {
>>     ++intervals;
>>     if (navigator.getGamepads()[0].foo != 5) {
>>       alert("What happened after " + intervals + " intervals?");
>>       clearInterval(id);
>>     }
>>   }, 1000);
>>
>> In Chrome's current implementation, where getGamepads() returns a new
>> object each time getGamepads()[0] is a new object each time this will
>> consistently alert "What happened after 1 intervals?".
>>
>> In Firefox's current implementation this will not alert at all unless the
>> set of connected gamepads changes.
>>
>> In an implementation which brokenly GCed and lazily recreated the JS
>> reflections of Gamepad objects, the alert could happen after some random
>> number of intervals, depending on GC timing.
>>
>
> I see. Let's not do that then ;).
>
>
>
>>
>> Does that help?
>>
>> -Boris
>>
>
>
>
> --
>     Cheers,
>     --MarkM
>
Received on Tuesday, 29 April 2014 19:28:12 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:24 UTC