Closed Bug 1550426 Opened 9 months ago Closed 7 months ago

[socket process] Consider using ChannelEventQueue in HttpTransactionParent

Categories

(Core :: Networking, defect, P2)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: kershaw, Assigned: kershaw)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

HttpTransactionParent which plays the same role as nsInputStreamPump in parent process should comply with the stream listener contract totally.
Currently, we have some code in HttpTransactionParent that tries to make HttpTransactionParent acts like nsInputStreamPump. Maybe the best way is try to reuse the code in [1].

[1] https://searchfox.org/mozilla-central/rev/197210b8c139b64f642edaa3336d26b9c1761568/netwerk/base/nsInputStreamPump.cpp#372-460

Could we just have an implementation of nsIAsyncInputStream that crosses IPC (an inter-process pipe, actually) and let the pump simply live on the parent and deliver as it is?

(In reply to Honza Bambas (:mayhemer) from comment #1)

Could we just have an implementation of nsIAsyncInputStream that crosses IPC (an inter-process pipe, actually) and let the pump simply live on the parent and deliver as it is?

I think this might be a good idea, since the code in HttpTransactionParent right now is a bit mess.

But using an IPC pipe to deliver data would break the way we used to send ODA to child process.

After some investigation, I believe that we should use ChannelEventQueue in HttpTransactionParent.
Here are the reasons:

  1. It's hard to reuse the code in nsInputStreamPump, since OnStartRequest/ODA/OnStopRequest are delivered as IPC messages.
  2. Bug 1544777 introduced an ugly hack for dealing with the re-entrancy issue caused by sync XHR. ChannelEventQueue is actually designed for this purpose [1].
  3. ChannelEventQueue has it's own suspend counter, so we don't have to implement it again (See bug 1497270).
  4. We can implement nsIThreadRetargetableRequest by leveraging ChannelEventQueue.

[1] https://searchfox.org/mozilla-central/rev/b418634cb3fe83ebb8d2c019cc1ba76974da1a0d/netwerk/ipc/ChannelEventQueue.h#73-78

Summary: [socket process] reuse the state machine from nsInputStreamPump in HttpTransactionParent → [socket process] Consider using ChannelEventQueue in HttpTransactionParent

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:kershaw, could you have a look please?
For more information, please visit auto_nag documentation.

Flags: needinfo?(kershaw)
Status: NEW → RESOLVED
Closed: 7 months ago
Flags: needinfo?(kershaw)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.