Closed Bug 1550560 Opened 5 years ago Closed 5 years ago

Allow marking an IPC actor as RefCounted

Categories

(Core :: IPC, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: nika, Assigned: nika)

References

(Blocks 1 open bug)

Details

Attachments

(5 files)

No description provided.
Type: defect → enhancement

The syntax for the new construct looks like the following, and re-uses the
refcounted keyword from refcounted using statements:

async refcounted protocol PFoo { ... }

This takes the approach of directly tying the AddRef() and Release() calls
on the underlying actor object to the lifecycle of the ActorLifecycleProxy
object, by adding another virtual ActorAlloc() method as the counterpart to
ActorDealloc().

The changes to the methods called from C++ are relatively minimal:

  1. The SendPFooConstructor(...) methods have the same signature, but now will
    AddRef() internally (through ActorAlloc()), so an do_AddRef(foo).take()
    isn't needed. Same with the {Bind,Open}PFooEndpoint methods.

    This was done to reduce the number of invasive internal changes in the
    codegen which were required to pipe a passed-in already_AddRefed to the
    underlying ActorLifecycleProxy which is created by generic code.

  2. The AllocPFoo{Parent,Child} methods have been modified to return an
    already_AddRefed by default, and the callsites will store the result in a
    RefPtr<T> if the type is refcounted.

  3. No DeallocPFoo... method is called anymore. Unfortunately due to
    devirtualization, it won't be an error if an unused method is still present,
    though it won't be called.

This is an example refcounted actor which was easy enough to port over as an
initial test. More can be ported in the future, potentially alongside removing
mIPCOpen.

Pushed by nlayzell@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1c6fd8c0baeb Part 1: Parse refcounted protocols in IPDL, r=mccr8 https://hg.mozilla.org/integration/autoland/rev/997252eb5071 Part 2: Generate logic for refcounted IPDL actors, r=mccr8 https://hg.mozilla.org/integration/autoland/rev/dad8b9f72267 Part 3: Make BrowserBridgeParent refcounted in IPDL, r=mccr8 https://hg.mozilla.org/integration/autoland/rev/d771fa8b9289 Part 4: Don't generate helper ctors for refcounted actors, r=mccr8 https://hg.mozilla.org/integration/autoland/rev/7977d9421ecd Part 5: Remove unnecessary Alloc method for PBrowserBridge, r=mccr8
Depends on: 1570366
Depends on: 1570367
Blocks: 1570366, 1570367
No longer depends on: 1570366, 1570367
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: