Backed out 2 changesets (bug 1881078, bug 1879806) for causing dt failures @ devtools...
[gecko.git] / netwerk / base / nsIAsyncStreamCopier2.idl
blob7de793f51e3270d63cdae1b8e21fa11b68e4ff5c
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/. */
5 #include "nsIRequest.idl"
7 interface nsIInputStream;
8 interface nsIOutputStream;
9 interface nsIRequestObserver;
10 interface nsIEventTarget;
12 [scriptable, uuid(a5b2decf-4ede-4801-8b38-e5fe5db46bf2)]
13 interface nsIAsyncStreamCopier2 : nsIRequest
15 /**
16 * Initialize the stream copier.
18 * If neither the source nor the sink are buffered, buffering will
19 * be automatically added to the sink.
22 * @param aSource
23 * contains the data to be copied.
24 * @param aSink
25 * specifies the destination for the data.
26 * @param aTarget
27 * specifies the thread on which the copy will occur. a null value
28 * is permitted and will cause the copy to occur on an unspecified
29 * background thread.
30 * @param aChunkSize
31 * specifies how many bytes to read/write at a time. this controls
32 * the granularity of the copying. it should match the segment size
33 * of the "buffered" streams involved.
34 * @param aCloseSource
35 * true if aSource should be closed after copying (this is generally
36 * the desired behavior).
37 * @param aCloseSink
38 * true if aSink should be closed after copying (this is generally
39 * the desired behavior).
41 void init(in nsIInputStream aSource,
42 in nsIOutputStream aSink,
43 in nsIEventTarget aTarget,
44 in unsigned long aChunkSize,
45 in boolean aCloseSource,
46 in boolean aCloseSink);
48 /**
49 * asyncCopy triggers the start of the copy. The observer will be notified
50 * when the copy completes.
52 * @param aObserver
53 * receives notifications.
54 * @param aObserverContext
55 * passed to observer methods.
57 void asyncCopy(in nsIRequestObserver aObserver,
58 in nsISupports aObserverContext);