Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include "nsIRequest.idl" |
michael@0 | 6 | |
michael@0 | 7 | interface nsIInputStream; |
michael@0 | 8 | interface nsIOutputStream; |
michael@0 | 9 | interface nsIRequestObserver; |
michael@0 | 10 | interface nsIEventTarget; |
michael@0 | 11 | |
michael@0 | 12 | // You should prefer nsIAsyncStreamCopier2 |
michael@0 | 13 | [scriptable, uuid(5a19ca27-e041-4aca-8287-eb248d4c50c0)] |
michael@0 | 14 | interface nsIAsyncStreamCopier : nsIRequest |
michael@0 | 15 | { |
michael@0 | 16 | /** |
michael@0 | 17 | * Initialize the stream copier. |
michael@0 | 18 | * |
michael@0 | 19 | * @param aSource |
michael@0 | 20 | * contains the data to be copied. |
michael@0 | 21 | * @param aSink |
michael@0 | 22 | * specifies the destination for the data. |
michael@0 | 23 | * @param aTarget |
michael@0 | 24 | * specifies the thread on which the copy will occur. a null value |
michael@0 | 25 | * is permitted and will cause the copy to occur on an unspecified |
michael@0 | 26 | * background thread. |
michael@0 | 27 | * @param aSourceBuffered |
michael@0 | 28 | * true if aSource implements ReadSegments. |
michael@0 | 29 | * @param aSinkBuffered |
michael@0 | 30 | * true if aSink implements WriteSegments. |
michael@0 | 31 | * @param aChunkSize |
michael@0 | 32 | * specifies how many bytes to read/write at a time. this controls |
michael@0 | 33 | * the granularity of the copying. it should match the segment size |
michael@0 | 34 | * of the "buffered" streams involved. |
michael@0 | 35 | * @param aCloseSource |
michael@0 | 36 | * true if aSource should be closed after copying. |
michael@0 | 37 | * @param aCloseSink |
michael@0 | 38 | * true if aSink should be closed after copying. |
michael@0 | 39 | * |
michael@0 | 40 | * NOTE: at least one of the streams must be buffered. If you do not know |
michael@0 | 41 | * whether your streams are buffered, you should use nsIAsyncStreamCopier2 |
michael@0 | 42 | * instead. |
michael@0 | 43 | */ |
michael@0 | 44 | void init(in nsIInputStream aSource, |
michael@0 | 45 | in nsIOutputStream aSink, |
michael@0 | 46 | in nsIEventTarget aTarget, |
michael@0 | 47 | in boolean aSourceBuffered, |
michael@0 | 48 | in boolean aSinkBuffered, |
michael@0 | 49 | in unsigned long aChunkSize, |
michael@0 | 50 | in boolean aCloseSource, |
michael@0 | 51 | in boolean aCloseSink); |
michael@0 | 52 | |
michael@0 | 53 | /** |
michael@0 | 54 | * asyncCopy triggers the start of the copy. The observer will be notified |
michael@0 | 55 | * when the copy completes. |
michael@0 | 56 | * |
michael@0 | 57 | * @param aObserver |
michael@0 | 58 | * receives notifications. |
michael@0 | 59 | * @param aObserverContext |
michael@0 | 60 | * passed to observer methods. |
michael@0 | 61 | */ |
michael@0 | 62 | void asyncCopy(in nsIRequestObserver aObserver, |
michael@0 | 63 | in nsISupports aObserverContext); |
michael@0 | 64 | }; |