[graphics] Remove direct use of ArrayBufferContents
In the context of an ongoing refactoring of WTF::ArrayBuffers we move the implementation out of libwtf. The idea is to merge it into DOMArrayBuffer eventually and get rid of WTF::ArrayBuffer completely. StaticBitmapImage included WTF::ArrayBufferContents but cannot include anything in third_party/blink/renderer/core/typed_arrays/*. With this CL I remove the direct creation of ArrayBufferContents in StaticBitmapImage. The idea behind the CL is that instead of creating an ArrayBufferContents in ConvertToArrayBufferContents, we just pass a pointer to the backing store of the ArrayBufferContents, and let StaticBitmapImage just fill that backing store with data. I renamed the function therefore to CopyToByteArray. To be able to allocate an ArrayBufferContents of the right size, StaticBitmapImage now also provides a SizeInBytes function, and MayHaveStrayArea to indicate if the backing store needs to be zero-initialized. Alternative implementations would be to just fill a WTF::Vector, and then copy the result into an ArrayBufferContents, or to provide a producer function to StaticBitmapImage so that it can allocate an ArrayBufferContents in an opaque way. I did not like both, the former requires extra copying, the latter is too complicated. R=jbroman@chromium.org Bug: chromium:1008840 Change-Id: I0b283dd9605f31905f3cb0d65615fc85d84e8f63 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1871674Reviewed-by:Jeremy Roman <jbroman@chromium.org> Commit-Queue: Andreas Haas <ahaas@chromium.org> Cr-Commit-Position: refs/heads/master@{#709065}
Showing
Please register or sign in to comment