Merge mozilla-central to autoland. CLOSED TREE
[gecko.git] / netwerk / base / nsIThreadRetargetableRequest.idl
blob508798756727dab50a66e0dd207ccb5c02ec790e
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsISupports.idl"
9 interface nsISerialEventTarget;
11 /**
12 * nsIThreadRetargetableRequest
14 * Should be implemented by requests that support retargeting delivery of
15 * data off the main thread.
17 [uuid(27b84c48-5a73-4ba4-a8a4-8b5e649a145e)]
18 interface nsIThreadRetargetableRequest : nsISupports
20 /**
21 * Called to retarget delivery of OnDataAvailable to another thread. Should
22 * only be called before AsyncOpen for nsIWebsocketChannels, or during
23 * OnStartRequest for nsIChannels.
24 * Note: For nsIChannels, OnStartRequest and OnStopRequest will still be
25 * delivered on the main thread.
27 * @param aNewTarget New event target, e.g. thread or threadpool.
29 * Note: no return value is given. If the retargeting cannot be handled,
30 * normal delivery to the main thread will continue. As such, listeners
31 * should be ready to deal with OnDataAvailable on either the main thread or
32 * the new target thread.
34 void retargetDeliveryTo(in nsISerialEventTarget aNewTarget);
36 /**
37 * Returns the event target where OnDataAvailable events will be dispatched.
39 * This is only valid after OnStartRequest has been called. Any time before
40 * that point, the value may be changed by `retargetDeliveryTo` calls.
42 readonly attribute nsISerialEventTarget deliveryTarget;