Closed Bug 1633650 Opened 4 years ago Closed 4 years ago

Interceptor: Don't call HandlerProvider::GetPayloadSize for external process callers

Categories

(Core :: IPC: MSCOM, defect)

defect

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: Jamie, Assigned: Jamie)

References

Details

Attachments

(1 file)

When an Interceptor is marshaled for an external (non-chrome) process caller, we do not provide a handler and thus don't call HandlerProvider::WriteHandlerPayload. However, GetMarshalSizeMax still calls HandlerProvider::GetPayloadSize. For a11y's handlerProvider, we must build the payload to get the size. This is wasteful (and maybe leaky?) if we're just going to throw it away.

To fix this, we can just avoid calling GetPayloadSize for external process callers.

When an Interceptor is marshaled for an external (non-chrome) process caller, we do not provide a handler and thus don't call HandlerProvider::WriteHandlerPayload.
However, GetMarshalSizeMax previously called HandlerProvider::GetPayloadSize even for external process callers.
For a11y's handlerProvider, we must build the payload to get the size.
This is wasteful in this case, since we're just going to throw it away.

(In reply to James Teh [:Jamie] from comment #0)

This is wasteful (and maybe leaky?) if we're just going to throw it away.

Some commentary on the "leaky" part of this. I'm not certain of this, but I think I'm right. :)

When we serialize the payload, it must AddRef on the interface pointers inside the payload. If the serializer isn't used, we do clean up its buffer when we destroy the Interceptor... but that doesn't Release on the interface pointers that the serializer AddReffed.

Oh, you know what? It probably does a CoMarshalInterface while serializing payload in order to serialize the interfaces, which would then AddRef.

Anyway, yeah, that's thorny. Better to not even do it in the first place.

Pushed by aklotz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b24946004137
mscom::Interceptor: Don't call HandlerProvider::GetPayloadSize for external process callers. r=aklotz
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
Blocks: 1572915
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: