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 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include "nsISupports.idl" |
michael@0 | 6 | |
michael@0 | 7 | interface nsIChannel; |
michael@0 | 8 | interface nsIParentChannel; |
michael@0 | 9 | |
michael@0 | 10 | /** |
michael@0 | 11 | * Used on the chrome process as a service to join channel implementation |
michael@0 | 12 | * and parent IPC protocol side under a unique id. Provides this way a generic |
michael@0 | 13 | * communication while redirecting to various protocols. |
michael@0 | 14 | * |
michael@0 | 15 | * See also nsIChildChannel and nsIParentChannel. |
michael@0 | 16 | */ |
michael@0 | 17 | |
michael@0 | 18 | [scriptable, uuid (efa36ea2-5b07-46fc-9534-a5acb8b77b72)] |
michael@0 | 19 | interface nsIRedirectChannelRegistrar : nsISupports |
michael@0 | 20 | { |
michael@0 | 21 | /** |
michael@0 | 22 | * Register the redirect target channel and obtain a unique ID for that |
michael@0 | 23 | * channel. |
michael@0 | 24 | * |
michael@0 | 25 | * Primarily used in HttpChannelParentListener::AsyncOnChannelRedirect to get |
michael@0 | 26 | * a channel id sent to the HttpChannelChild being redirected. |
michael@0 | 27 | */ |
michael@0 | 28 | uint32_t registerChannel(in nsIChannel channel); |
michael@0 | 29 | |
michael@0 | 30 | /** |
michael@0 | 31 | * First, search for the channel registered under the id. If found return |
michael@0 | 32 | * it. Then, register under the same id the parent side of IPC protocol |
michael@0 | 33 | * to let it be later grabbed back by the originator of the redirect and |
michael@0 | 34 | * notifications from the real channel could be forwarded to this parent |
michael@0 | 35 | * channel. |
michael@0 | 36 | * |
michael@0 | 37 | * Primarily used in parent side of an IPC protocol implementation |
michael@0 | 38 | * in reaction to nsIChildChannel.connectParent(id) called from the child |
michael@0 | 39 | * process. |
michael@0 | 40 | */ |
michael@0 | 41 | nsIChannel linkChannels(in uint32_t id, in nsIParentChannel channel); |
michael@0 | 42 | |
michael@0 | 43 | /** |
michael@0 | 44 | * Returns back the channel previously registered under the ID with |
michael@0 | 45 | * registerChannel method. |
michael@0 | 46 | * |
michael@0 | 47 | * Primarilly used in chrome IPC side of protocols when attaching a redirect |
michael@0 | 48 | * target channel to an existing 'real' channel implementation. |
michael@0 | 49 | */ |
michael@0 | 50 | nsIChannel getRegisteredChannel(in uint32_t id); |
michael@0 | 51 | |
michael@0 | 52 | /** |
michael@0 | 53 | * Returns the stream listener that shall be attached to the redirect target |
michael@0 | 54 | * channel, all notification from the redirect target channel will be |
michael@0 | 55 | * forwarded to this stream listener. |
michael@0 | 56 | * |
michael@0 | 57 | * Primarilly used in HttpChannelParentListener::OnRedirectResult callback |
michael@0 | 58 | * to grab the created parent side of the channel and forward notifications |
michael@0 | 59 | * to it. |
michael@0 | 60 | */ |
michael@0 | 61 | nsIParentChannel getParentChannel(in uint32_t id); |
michael@0 | 62 | |
michael@0 | 63 | /** |
michael@0 | 64 | * To not force all channel implementations to support weak reference |
michael@0 | 65 | * consumers of this service must ensure release of registered channels them |
michael@0 | 66 | * self. This releases both the real and parent channel registered under |
michael@0 | 67 | * the id. |
michael@0 | 68 | * |
michael@0 | 69 | * Primarilly used in HttpChannelParentListener::OnRedirectResult callback. |
michael@0 | 70 | */ |
michael@0 | 71 | void deregisterChannels(in uint32_t id); |
michael@0 | 72 | }; |