• Darin Fisher's avatar
    Introduce skia.mojom.UnsafeBitmap for more efficient bitmap transfer · af69de90
    Darin Fisher authored
    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: default avatarDaniel Cheng <dcheng@chromium.org>
    Reviewed-by: default avatarKen Rockot <rockot@google.com>
    Reviewed-by: default avatarErik Chen <erikchen@chromium.org>
    Reviewed-by: default avatarGreg Kerr <kerrnel@chromium.org>
    Commit-Queue: Darin Fisher <darin@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#815217}
    af69de90
BUILD.gn 2.5 KB