-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the close() method to the ImageBitmap interface #1078
Conversation
<p>The <dfn><code data-x="dom-ImageBitmap-width">width</code></dfn> attribute's getter must run | ||
these steps:</p> | ||
|
||
<ol> | ||
<li><p>If this <code>ImageBitmap</code> object's [[<span>Detached</span>]] internal slot's | ||
<li><p>If <b>this</b>'s [[<span>Detached</span>]] internal slot's |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by editorial tweak.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current form is actually preferable, at least for now and in HTML. this technically only has meaning, currently, in ES-style algorithms, so we've been trying to use "this X object" or "this element" instead.
Eventually we may have Web IDL define the this
keyword to mean "the Web IDL object corresponding to the JavaScript object given by this
" or something like that.
I assume Chrome is interested :). If so, we have two vendors, so LGTM except without the drive-by editorial tweak. |
This method releases the graphics resources held by an ImageBitmap object. This is part of the larger OffscreenCanvas feature proposal: https://wiki.whatwg.org/wiki/OffscreenCanvas This is already implemented and shipping in Firefox 46: https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap/close It is implemented and will ship soon in Chrome.
Done. |
It is true that the effect of unsetting is not observable in JS, but it is observable for the user. One of the purposes of this API is to force an immediate release of resources instead of waiting for the ImageBitmap to be garbage collected. So being explicit about makes some sense IMHO. From a practical standpoint there are several justifications for this:
|
This method releases the graphics resources held by an
ImageBitmap object.
This is part of the larger OffscreenCanvas feature proposal:
https://wiki.whatwg.org/wiki/OffscreenCanvas
The only known implementation at this time is in Firefox:
https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap/close