[blink-dev] Intent to Implement and Ship: ImageBitmap.close()

39 views
Skip to first unread message

Xida Chen

unread,
Apr 21, 2016, 11:17:50 AM4/21/16
to blink-dev

Contact emails

xida...@chromium.org, ju...@chromium.org


Spec

https://html.spec.whatwg.org/#images


Summary

The ImageBitmap.close() method disposes of all graphical resources associated with an ImageBitmap.


Is this feature supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes.


Demo link

No demos. But the developers can turn on experimental canvas features flag in browser to try this feature.

This MDN page: https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap/close provides a typical usage of this method.


Debuggability

This feature does not require special debugging support on its own.


Interoperability and Compatibility Risk

Interoperability risk is low. Firefox has release this feature in version 46 (https://developer.mozilla.org/en-US/Firefox/Releases/46). Other browsers have no public signals yet. Compatibility risk is low, as this does not remove or change existing features.


OWP launch tracking bug

https://crbug.com/605186


Entry on the feature dashboard

https://www.chromestatus.com/features#imagebitmap

Rick Byers

unread,
Apr 21, 2016, 11:20:29 AM4/21/16
to Xida Chen, blink-dev
LGTM1

Chris Harrelson

unread,
Apr 21, 2016, 11:33:21 AM4/21/16
to Rick Byers, Xida Chen, blink-dev
What will Blink's actual behavior be if you try to use an ImageBitmap after close()? It seems undefined according to spec.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

Anne van Kesteren

unread,
Apr 21, 2016, 11:38:30 AM4/21/16
to Chris Harrelson, Rick Byers, Xida Chen, blink-dev
On Thu, Apr 21, 2016 at 5:33 PM, Chris Harrelson <chri...@chromium.org> wrote:
> What will Blink's actual behavior be if you try to use an ImageBitmap after
> close()? It seems undefined according to spec.

Where is it undefined?


--
https://annevankesteren.nl/

Xida Chen

unread,
Apr 21, 2016, 11:45:06 AM4/21/16
to Chris Harrelson, Rick Byers, blink-dev
Hi Chris,

The spec says:

imageBitmap . close()

Releases imageBitmap's underlying bitmap data.


In Blink, after calling ImageBitmap.close(), ImageBitmap's width and height become 0. I hope that answers your question.

Chris Harrelson

unread,
Apr 21, 2016, 11:47:59 AM4/21/16
to Xida Chen, Rick Byers, blink-dev
On Thu, Apr 21, 2016 at 8:45 AM Xida Chen <xida...@chromium.org> wrote:
Hi Chris,

The spec says:

imageBitmap . close()

Releases imageBitmap's underlying bitmap data.


In Blink, after calling ImageBitmap.close(), ImageBitmap's width and height become 0. I hope that answers your question.

Yes, that was my question. Then it's equivalent to a 0x0 image? Sounds reasonable. LGTM2.

Chris Harrelson

unread,
Apr 21, 2016, 11:49:54 AM4/21/16
to Anne van Kesteren, Rick Byers, Xida Chen, blink-dev
On Thu, Apr 21, 2016 at 8:38 AM Anne van Kesteren <ann...@annevk.nl> wrote:
On Thu, Apr 21, 2016 at 5:33 PM, Chris Harrelson <chri...@chromium.org> wrote:
> What will Blink's actual behavior be if you try to use an ImageBitmap after
> close()? It seems undefined according to spec.

Where is it undefined?

The spec says that the object is marked as detached and its data is unset. I don't think it says what happens if you try to draw it into a canvas after that.

 


--
https://annevankesteren.nl/

Anne van Kesteren

unread,
Apr 21, 2016, 12:03:46 PM4/21/16
to Chris Harrelson, Rick Byers, Xida Chen, blink-dev
On Thu, Apr 21, 2016 at 5:49 PM, Chris Harrelson <chri...@chromium.org> wrote:
> The spec says that the object is marked as detached and its data is unset. I
> don't think it says what happens if you try to draw it into a canvas after
> that.

Ah yes, indeed.
https://html.spec.whatwg.org/multipage/scripting.html#check-the-usability-of-the-image-argument
should be updated to throw for that scenario. I filed
https://github.com/whatwg/html/issues/1085.


--
https://annevankesteren.nl/

Chris Harrelson

unread,
Apr 21, 2016, 12:07:24 PM4/21/16
to Anne van Kesteren, Rick Byers, Xida Chen, blink-dev
Ok. Xida, you should change your implementation to match. And file a bug for Firefox too, if it doesn't already throw.

Xida Chen

unread,
Apr 22, 2016, 1:46:51 PM4/22/16
to Chris Harrelson, Anne van Kesteren, Rick Byers, blink-dev
I have checked Firefox's behavior and filed a bug here:

Also added a CL to chromium code base:

Philip Jägenstedt

unread,
Apr 26, 2016, 10:27:56 AM4/26/16
to Xida Chen, Chris Harrelson, Anne van Kesteren, Rick Byers, blink-dev
LGTM2

Xida Chen

unread,
Apr 26, 2016, 10:30:40 AM4/26/16
to Chris Harrelson, Rick Byers, blink-dev
On Thu, Apr 21, 2016 at 11:47 AM, Chris Harrelson <chri...@chromium.org> wrote:

On Thu, Apr 21, 2016 at 8:45 AM Xida Chen <xida...@chromium.org> wrote:
Hi Chris,

The spec says:

imageBitmap . close()

Releases imageBitmap's underlying bitmap data.


In Blink, after calling ImageBitmap.close(), ImageBitmap's width and height become 0. I hope that answers your question.

Yes, that was my question. Then it's equivalent to a 0x0 image? Sounds reasonable. LGTM2.


Hi Philip,

Since Chris gave a LGTM2 before, I guess yours is LGTM3? 

Philip Jägenstedt

unread,
Apr 26, 2016, 11:18:00 AM4/26/16
to Xida Chen, Chris Harrelson, Rick Byers, blink-dev
Well I am just terrible at counting recently. LGTM3 :) 
Reply all
Reply to author
Forward
0 new messages