Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Issue 2772113004: Make skia.mojom.Bitmap use shared buffer (Closed)

Created:
3 years, 9 months ago by xiyuan
Modified:
3 years, 9 months ago
CC:
Aaron Boodman, abarth-chromium, chromium-reviews, darin (slow to review), qsr+mojo_chromium.org, rsesek+watch_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Make skia.mojom.Bitmap use shared buffer - Merge gfx.mojom.SharedBufferSkBitmap into skia.mojom.Bitmap to transport pixel data via shared buffer. Shared buffer is created on the sender side by copying source pixel data. On the receiving end, the shared buffer is used to installPixels on the output SkBitmap. Only one copy happens for the process. The cost is that the shared buffer mapping has to be kept around for the lifetime of the output SkBitmap; - Update test expectations of gfx.mojom.ImageSkia[Rep] because empty SkBitmap would end up as null on the other end (as a result of installPixels using shared buffer); BUG=655874

Patch Set 1 #

Patch Set 2 : fix gn check #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+72 lines, -162 lines) Patch
M skia/public/interfaces/bitmap.mojom View 1 chunk +2 lines, -1 line 2 comments Download
M skia/public/interfaces/bitmap_skbitmap_struct_traits.h View 2 chunks +3 lines, -5 lines 0 comments Download
M skia/public/interfaces/bitmap_skbitmap_struct_traits.cc View 3 chunks +53 lines, -26 lines 5 comments Download
M ui/gfx/image/mojo/BUILD.gn View 1 1 chunk +4 lines, -0 lines 0 comments Download
M ui/gfx/image/mojo/image.mojom View 1 chunk +5 lines, -15 lines 0 comments Download
M ui/gfx/image/mojo/image.typemap View 2 chunks +0 lines, -2 lines 0 comments Download
M ui/gfx/image/mojo/image_skia_struct_traits.h View 2 chunks +0 lines, -25 lines 0 comments Download
M ui/gfx/image/mojo/image_skia_struct_traits.cc View 1 chunk +0 lines, -70 lines 0 comments Download
M ui/gfx/image/mojo/image_traits_unittest.cc View 3 chunks +5 lines, -18 lines 1 comment Download

Depends on Patchset:

Messages

Total messages: 15 (9 generated)
xiyuan
msw@, please review. This tickles me and I have to do it before the weekend. ...
3 years, 9 months ago (2017-03-24 23:00:25 UTC) #2
msw
https://codereview.chromium.org/2772113004/diff/20001/skia/public/interfaces/bitmap.mojom File skia/public/interfaces/bitmap.mojom (right): https://codereview.chromium.org/2772113004/diff/20001/skia/public/interfaces/bitmap.mojom#newcode45 skia/public/interfaces/bitmap.mojom:45: handle<shared_buffer>? pixel_data_buffer_handle; Does it make sense to have our ...
3 years, 9 months ago (2017-03-25 00:59:53 UTC) #11
Ken Rockot(use gerrit already)
I doubt we really want this to be the default behavior for all SkBitmaps. Please ...
3 years, 9 months ago (2017-03-26 17:52:50 UTC) #12
xiyuan
On 2017/03/26 17:52:50, Ken Rockot wrote: > I doubt we really want this to be ...
3 years, 9 months ago (2017-03-27 16:43:51 UTC) #13
msw
On 2017/03/27 16:43:51, xiyuan wrote: > On 2017/03/26 17:52:50, Ken Rockot wrote: > > I ...
3 years, 9 months ago (2017-03-27 17:01:07 UTC) #14
xiyuan
3 years, 9 months ago (2017-03-27 17:06:13 UTC) #15
Message was sent while issue was closed.
On 2017/03/27 17:01:07, msw wrote:
> On 2017/03/27 16:43:51, xiyuan wrote:
> > On 2017/03/26 17:52:50, Ken Rockot wrote:
> > > I doubt we really want this to be the default behavior for all SkBitmaps.
> > Please
> > > keep in mind that on Windows and OS X, allocating a shared buffer in a
> > sandboxed
> > > process requires that we do an internal sync IPC requesting the allocation
> > from
> > > a more privileged process. We could probably improve the  situation
slightly
> > by
> > > having a dedicated thread in the broker process for handling those
requests,
> > but
> > > still this is almost certainly more expensive than copying the pixel data
an
> > > extra time for some reasonably small bitmaps.
> > > 
> > 
> > Yep, did not realize that we were using this inside sandboxed process.
> > Abandoned.
> 
> Does that mean we shouldn't use the shared buffer ImageSkia mojom for certain
> things? Is it okay to use it for chrome<->ash shelf item and window icons,
etc.?
> Should we have a separate ImageSkia struct traits that copies pixels like
> SkBitmaps?

The shared buffer creation code would not run inside a sandboxed process. It is
okay for chrome -> ash since chrome has the privilege. Not so sure about ash ->
chrome in the long run. It works now but it might break when we want to add some
restriction to ash.

Powered by Google App Engine
This is Rietveld 408576698