netwerk/base/public/nsIAsyncStreamCopier2.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial