Source code

Revision control

Other Tools

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 nsIChannels.
24
* Note: For nsIChannels, 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
* Returns the event target where OnDataAvailable events will be dispatched.
38
*
39
* This is only valid after OnStartRequest has been called. Any time before
40
* that point, the value may be changed by `retargetDeliveryTo` calls.
41
*/
42
readonly attribute nsIEventTarget deliveryTarget;
43
};