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 Shmem
s 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•2 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•2 years ago
|
Pushed by jblandy@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b94861755266 Replace `Shmem::PrivateIPDLCaller` with `friend` specifiers. r=nika
Comment 3•2 years ago
|
||
Backed out for causing build bustages on ProtocolFuzzer.h
Pushed by jblandy@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3772e557a8b9 Replace `Shmem::PrivateIPDLCaller` with `friend` specifiers. r=nika
Description
•