Move SafeRefPtr to mfbt
Categories
(Core :: MFBT, task)
Tracking
()
People
(Reporter: sg, Unassigned)
References
Details
Bug 1620273 added SafeRefPtr as a variant of RefPtr with some deliberate differences to increase safety and avoid other issues, in particular:
- It is not implicitly convertible from a raw pointer. Unsafe acquisitions
from a raw pointer must be made using the verbose
AcquireStrongRefFromRawPtr. To create a new object on the heap, use
MakeSafeRefPtr. - It does not implicitly decay to a raw pointer. unsafeGetRawPtr() must be
called explicitly. - It is not copyable, but must be explicitly copied using clonePtr().
- Temporaries cannot be dereferenced using operator* or operator->.
While use can be intermixed with raw pointers and RefPtr for a particular type, it is intentionally clumsy to do so. Therefore, it's more adequate to change all uses for a particular type at once.
Currently, the source file (and its tests) resides in dom/indexedDB, but it's exported to the mozilla/ directory. It should move over to mfbt/. It has been used for a while in various DOM Workers & Storage components, and assured more reliance on the absence of certain unsafe and otherwise disadvantageous uses enforced by the type system.
This likely addresses the issues raised in Bugs 884027, 767178, 1061144, 1600282.
| Reporter | ||
Updated•5 years ago
|
Description
•