Shmem::PrivateIPDLCaller is a poor substitute for `friend` and `private`
Categories
(Core :: IPC, enhancement, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox105 | --- | fixed |
People
(Reporter: jimb, Assigned: jimb, NeedInfo)
Details
Attachments
(1 file)
The mozilla::ipc::Shmem class's PrivateIPDLCaller member type is used to discourage developers from adding calls to certain Shmem methods - but this purpose is better served using C++'s private members and friend specifiers: IProtocol and IToplevelProtocol should become friends of Shmem.
Note that, if a class C designates some other class F as a friend, classes derived from F are not considered friends of C. So making IProtocol and IToplevelProtocol friends of Shmem does not grant all IPDL actors access to Shmem's private members.
However, using friend does grant IProtocol and IToplevelProtocol access to Shmems private data members, not just their member functions, as with disciplined use of PrivateIPDLCaller. But this seems like a reasonable compromise in exchange for better static checks and error messages.
| Assignee | ||
Comment 1•3 years ago
|
||
Instead of using the public member type PrivateIPDLCaller to
restrict access to certain Shmem member functions, make them
private, and designated IProtocol and ITopLevelProtocol as
friends of Shmem.
Updated•3 years ago
|
Comment 3•3 years ago
|
||
Backed out for causing build bustages on ProtocolFuzzer.h
Description
•