Closed Bug 1781129 Opened 2 years ago Closed 2 years ago

Migrate DataTransfer IPC to use BigBuffer instead of Shmem

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
106 Branch
Tracking Status
firefox106 --- fixed

People

(Reporter: nika, Assigned: nika, NeedInfo)

References

(Blocks 2 open bugs)

Details

Attachments

(4 files)

I originally wrote these patches in the original bug 1681359, but figured it might make more sense to split up the landings.

This should improve the ergonomics of using these APIs, as well as open up opportunities for us to handle some cases which were previously impossible with e10s such as pasting arbitrary files.

The IPCDataTransfer type is used to transfer Clipboard/Drag & Drop payloads
over IPC to allow them to be written to or read from the relevant system
interfaces. Previously, the system which was used was somewhat complex, and
tried to use Shmem in some cases to store buffers out of line. Now that
BigBuffer is available, it can be simplified substantially.

In addition, this change removed the memory buffer overload of GetSurfaceData,
as the only consumer was using it to immediately send the payload over IPC as a
nsCString. It was changed to instead use BigBuffer as that is more efficient
in a large buffer situation, and reduces the number of required copies.

Depends on D151851

The ShmemImage type was previously implemented using a Shmem, however due to
the usage patterns, BigBuffer is probably a better fit, and allows unifying
more code in nsContentUtils.

Depends on D151852

After the previous changes there was only one consumer left of the Shmem
version of GetSurfaceData, which could easily be changed to use BigBuffer,
removing the need for that overload.

After that consumer is removed, the interface was also simplified as the
generic logic in the implementation was no longer necessary.

Depends on D151853

Due to Shmem implementing ParamTraits, it is possible for a Shmem argument to
not be visible to the IPDL compiler as it is only serialized within an opaque
type included with using. If that happens, it would cause the construction of
the Shmem to fail on the other side, in a hard to diagnose manner. This changes
the logic to always allow any actor to manage shmems, to make it more in line
with the AllocShmem method being directly declared on IProtocol.

This specifically caused issues after this patch stack with PContent, which no
longer has any shmem arguments visible to IPDL after these changes, but still
is used as a manager for Shmems included in some messages.

Depends on D151854

Oh this is extremely cool. Thank you Nika! Copy and pasting files now seems to work on Linux with some obvious tweaks in DataTransfer::CacheExternalData.

Blocks: 1699743
Blocks: 1782043
Pushed by nlayzell@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/726458f976ff Part 1: Use BigBuffer for IPCDataTransfer, r=edgar https://hg.mozilla.org/integration/autoland/rev/fc135243503e Part 2: Use BigBuffer for ShmemImage, r=edgar https://hg.mozilla.org/integration/autoland/rev/bce3f99441c0 Part 3: Remove Shmem overload of GetSurfaceData, r=edgar https://hg.mozilla.org/integration/autoland/rev/4a92d58726aa Part 4: Fix issues caused by Shmem arguments no longer being visible to ipdl, r=ipc-reviewers,jld

Backed out 4 changesets (Bug 1781129) for causing bustages on nsContentUtils.cpp.
Backout link
Push with failures
Failure Log

Flags: needinfo?(nika)
Flags: needinfo?(nika)
Pushed by nlayzell@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0d0f19a4db70 Part 1: Use BigBuffer for IPCDataTransfer, r=edgar https://hg.mozilla.org/integration/autoland/rev/905393f66985 Part 2: Use BigBuffer for ShmemImage, r=edgar https://hg.mozilla.org/integration/autoland/rev/df6f98df9559 Part 3: Remove Shmem overload of GetSurfaceData, r=edgar https://hg.mozilla.org/integration/autoland/rev/8557305bcd46 Part 4: Fix issues caused by Shmem arguments no longer being visible to ipdl, r=ipc-reviewers,jld

Backed out 4 changesets (Bug 1781129) for causing bustages on nsContentUtils.cpp.
Backout link
Push with failures <--> Bb
Failure Log

Flags: needinfo?(nika)
Flags: needinfo?(nika)
Depends on: 1783240
Pushed by nlayzell@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0df2f2832755 Part 1: Use BigBuffer for IPCDataTransfer, r=edgar https://hg.mozilla.org/integration/autoland/rev/dcebc98ea1f1 Part 2: Use BigBuffer for ShmemImage, r=edgar https://hg.mozilla.org/integration/autoland/rev/1ae213bfa43e Part 3: Remove Shmem overload of GetSurfaceData, r=edgar https://hg.mozilla.org/integration/autoland/rev/37da1d18cde9 Part 4: Fix issues caused by Shmem arguments no longer being visible to ipdl, r=ipc-reviewers,jld

Backed out 4 changesets (Bug 1781129) for causing mochitest failures on test_bug490879.html.
Backout link
Push with failures <--> 4
Failure Log

Flags: needinfo?(nika)
Pushed by nlayzell@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8ab38c9b4f25 Part 1: Use BigBuffer for IPCDataTransfer, r=edgar https://hg.mozilla.org/integration/autoland/rev/ac8bea9c2071 Part 2: Use BigBuffer for ShmemImage, r=edgar https://hg.mozilla.org/integration/autoland/rev/3f7f3285c842 Part 3: Remove Shmem overload of GetSurfaceData, r=edgar https://hg.mozilla.org/integration/autoland/rev/be22852de7df Part 4: Fix issues caused by Shmem arguments no longer being visible to ipdl, r=ipc-reviewers,jld
Regressions: 1787584
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: