Introduce skia.mojom.UnsafeBitmap for more efficient bitmap transfer
This type is binary compatible with skia.mojom.Bitmap and only serves to specify a difference in the generated bindings. Instead of copying the pixels out of shared memory into a heap allocated buffer retained by the SkBitmap, the bindings will allow the SkBitmap to simply retain the given shared memory buffer. This avoids a potentially large copy. This change leverages SkBitmap's support for having its pixel backing managed externally via SkPixelRef. The BigBuffer received over IPC is stored in a new SkPixelRef subclass. The outcome of this is that if the BigBuffer was using shared memory then the SkBitmap will be able to reference that memory directly, thus avoiding a copy of the pixels. Finally, the Lacros code for screen capture is updated to use this new type to eliminate a large buffer copy. Bug: 1094460 Change-Id: I9249ad40ced16c8cbe42bbbe5d11d9820cc75d7f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2450838Reviewed-by:Daniel Cheng <dcheng@chromium.org> Reviewed-by:
Ken Rockot <rockot@google.com> Reviewed-by:
Erik Chen <erikchen@chromium.org> Reviewed-by:
Greg Kerr <kerrnel@chromium.org> Commit-Queue: Darin Fisher <darin@chromium.org> Cr-Commit-Position: refs/heads/master@{#815217}
Showing
Please register or sign in to comment