Source code

Revision control

Other Tools

1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
* License, v. 2.0. If a copy of the MPL was not distributed with this
3
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
#include "nsISupports.idl"
6
7
interface nsITransport;
8
interface nsIInputStream;
9
interface nsIOutputStream;
10
interface nsIInputAvailableCallback;
11
12
/**
13
* This service read/writes a stream on a background thread.
14
*
15
* Note: instead of using this interface, probably you want to use
16
* NS_MakeAsyncNonBlockingInputStream.
17
*
18
* Use this service to transform any blocking stream (e.g., file stream)
19
* into a fully asynchronous stream that can be read/written without
20
* blocking the main thread.
21
*/
22
[builtinclass, scriptable, uuid(5e0adf7d-9785-45c3-a193-04f25a75da8f)]
23
interface nsIStreamTransportService : nsISupports
24
{
25
/**
26
* CreateInputTransport
27
*
28
* @param aStream
29
* The input stream that will be read on a background thread.
30
* This stream must implement "blocking" stream semantics.
31
* @param aCloseWhenDone
32
* Specify this flag to have the input stream closed once its
33
* contents have been completely read.
34
*
35
* @return nsITransport instance.
36
*/
37
nsITransport createInputTransport(in nsIInputStream aStream,
38
in boolean aCloseWhenDone);
39
40
void InputAvailable(in nsIInputStream aStream,
41
in nsIInputAvailableCallback aCallback);
42
};
43
44
[builtinclass, uuid(ff2da731-44d0-4dd9-8236-c99387fec721)]
45
interface nsIInputAvailableCallback : nsISupports
46
{
47
void onInputAvailableComplete(in unsigned long long available,
48
in nsresult available_return_code);
49
};