|
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/. */ |
|
6 |
|
7 #include "nsISupports.idl" |
|
8 |
|
9 interface nsIEventTarget; |
|
10 |
|
11 /** |
|
12 * nsIThreadRetargetableRequest |
|
13 * |
|
14 * Should be implemented by requests that support retargeting delivery of |
|
15 * data off the main thread. |
|
16 */ |
|
17 [uuid(27b84c48-5a73-4ba4-a8a4-8b5e649a145e)] |
|
18 interface nsIThreadRetargetableRequest : nsISupports |
|
19 { |
|
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 nsIHttpChannels. |
|
24 * Note: For nsIHttpChannels, OnStartRequest and OnStopRequest will still be |
|
25 * delivered on the main thread. |
|
26 * |
|
27 * @param aNewTarget New event target, e.g. thread or threadpool. |
|
28 * |
|
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. |
|
33 */ |
|
34 void retargetDeliveryTo(in nsIEventTarget aNewTarget); |
|
35 }; |
|
36 |
|
37 |