Closed Bug 1662564 Opened 4 years ago Closed 4 years ago

Use RAII classes in base::SharedMemory

Categories

(Core :: IPC, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
83 Branch
Tracking Status
firefox83 --- fixed

People

(Reporter: jld, Assigned: jld)

References

Details

Attachments

(2 files)

I have some cleanups for base::SharedMemory in my topic branch for bug 1440203 that I'm breaking out into a separate bug:

  1. Using mozilla::UniqueFileHandle instead of raw ints/HANDLEs. This makes it easier to avoid fd/handle leaks or double closes, which is useful given how freezing and memfd both increase the complexity of this code, and slightly reduces the per-platform code here.

  2. Changing the mapped memory to a UniquePtr instance, with a stateful deleter on POSIX platforms. This encapsulates some things that have caused problems in the past. More usefully, combined with the above change, this allows = defaulting the default and move constructors; in the past it's been too easy to forget to handle a new or changed field in one of them.

Pushed by jedavis@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3a2941fa7d4b
Change IPC base::SharedMemory to use RAII for file descriptors/handles. r=nika
https://hg.mozilla.org/integration/autoland/rev/f6527a1d0f14
Use RAII for the memory mapping in IPC base::SharedMemory, and default its constructors. r=nika
Flags: needinfo?(jld)
Pushed by jedavis@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/08a6fb2b9100
Change IPC base::SharedMemory to use RAII for file descriptors/handles. r=nika
https://hg.mozilla.org/integration/autoland/rev/ad1bd0312bcd
Use RAII for the memory mapping in IPC base::SharedMemory, and default its constructors. r=nika
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 83 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: