On Mon, Jul 20, 2015 at 12:27 AM, Robert O'Callahan
<[email protected]> wrote:
> On Mon, Jul 20, 2015 at 6:33 PM, Jonas Sicking <[email protected]> wrote:
>>
>> Good point. We also need to call
>> URL.revokeObjectURL(this.mOldObjectURL); in the .src setter and in the
>> dtor.
>
>
> OK, but we still leak if someone saves a reference to the HTMLMediaElement
> as an expando property of the Blob/File.
>
> It would be best to store a reference to the Blob or File in the
> HTMLMediaElement and let the cycle collector do the work --- like we
> currently do for MediaStream srcObjects.
That's a good point.
One solution would be to just never create a URL and instead get a
channel directly from the Blob/File.
Another solution is that it would actually be quite possible to
cycle-collect through the URL hash. I.e. do something like the
following in the srcObject setter:
URL.revokeObjectURL(this.mOldObjectURL);
this.mOldObjectURL = URL.createObjectURL(blob);
this.mObjectSrc = blob;
LoadSrc(this.mOldObjectURL);
And then in the cycle collector do
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mObjectSrc)
if (this.mOldObjectURL) {
// Account for the reference that the URL hashtable holds.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mObjectSrc)
}
/ Jonas
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform