Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include "nsISupports.idl" |
michael@0 | 8 | |
michael@0 | 9 | %{C++ |
michael@0 | 10 | namespace mozilla { |
michael@0 | 11 | namespace net { |
michael@0 | 12 | class ChannelDiverterChild; |
michael@0 | 13 | } |
michael@0 | 14 | } |
michael@0 | 15 | %} |
michael@0 | 16 | |
michael@0 | 17 | [ptr] native ChannelDiverterChild(mozilla::net::ChannelDiverterChild); |
michael@0 | 18 | |
michael@0 | 19 | interface nsIStreamListener; |
michael@0 | 20 | |
michael@0 | 21 | /** |
michael@0 | 22 | * A channel implementing this interface allows diverting from an |
michael@0 | 23 | * nsIStreamListener in the child process to one in the parent. |
michael@0 | 24 | */ |
michael@0 | 25 | [uuid(4430e0d0-ff70-45f5-99dc-b5fd06943fc1)] |
michael@0 | 26 | interface nsIDivertableChannel : nsISupports |
michael@0 | 27 | { |
michael@0 | 28 | /** |
michael@0 | 29 | * CHILD ONLY. |
michael@0 | 30 | * Called by Necko client in child process during OnStartRequest to divert |
michael@0 | 31 | * nsIStreamListener and nsIRequest callbacks to the parent process. |
michael@0 | 32 | * |
michael@0 | 33 | * The process should look like the following: |
michael@0 | 34 | * |
michael@0 | 35 | * 1) divertToParent is called in the child process. It can only be called |
michael@0 | 36 | * during OnStartRequest(). |
michael@0 | 37 | * |
michael@0 | 38 | * 2) The ChannelDiverterChild that is returned is an IPDL object. It should |
michael@0 | 39 | * be passed via some other IPDL method of the client's choosing to the |
michael@0 | 40 | * parent. On the parent the ChannelDiverterParent's divertTo() function |
michael@0 | 41 | * should be called with an nsIStreamListener that will then receive the |
michael@0 | 42 | * OnStartRequest/OnDataAvailable/OnStopRequest for the channel. The |
michael@0 | 43 | * ChannelDiverterParent can then be deleted (which will also destroy the |
michael@0 | 44 | * ChannelDiverterChild in the child). |
michael@0 | 45 | * |
michael@0 | 46 | * After divertToParent() has been called, NO further function calls |
michael@0 | 47 | * should be made on the channel. It is a dead object for all purposes. |
michael@0 | 48 | * The reference that the channel holds to the listener in the child is |
michael@0 | 49 | * released is once OnStartRequest completes, and no other |
michael@0 | 50 | * nsIStreamListener calls (OnDataAvailable, OnStopRequest) will be made |
michael@0 | 51 | * to it. |
michael@0 | 52 | * |
michael@0 | 53 | * @return ChannelDiverterChild IPDL actor to be passed to parent process by |
michael@0 | 54 | * client IPDL message, e.g. PClient.DivertUsing(PDiverterChild). |
michael@0 | 55 | * |
michael@0 | 56 | * @throws exception if the channel was canceled early. Throws status code of |
michael@0 | 57 | * canceled channel. |
michael@0 | 58 | */ |
michael@0 | 59 | ChannelDiverterChild divertToParent(); |
michael@0 | 60 | }; |