Open Bug 1038977 Opened 11 years ago Updated 3 years ago

Shmem should use refcounted pointer classes when destroying SharedMemory

Categories

(Core :: IPC, defect)

defect

Tracking

()

People

(Reporter: mccr8, Unassigned)

References

Details

There's more that can be done after bug 1038966 that isn't needed for bug 1028148. - Shmem::Dealloc() should probably be renamed to Shmem::ReleaseSharedMemory() or something, because it doesn't deallocate, it releases. - DestroySegment() could be inlined. The name is bad and all it does is call Release(). The nullcheck can be dropped from the debug version of Dealloc(). - It should probably take something like already_AddRefed or nsRefPtr& as an argument instead of a raw pointer. - Then, the IPDL code that is pulling the SharedMemory out of mShmemMap will explicitly coerce the raw memory into some more explicit container (like the inverse of take) that indicates it has the reference, and pass that through to Dealloc().
Summary: Clean up refcounted pointerness of Shmem::Dealloc → Shmem should use refcounted pointer classes when destroying SharedMemory
There's also some code in PFoo{Parent,Child}::AdoptSharedMemory that is doing raw AddRef() on SharedMemory. Maybe that could be improved as well.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.