1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/base/public/nsIAsyncStreamCopier2.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "nsIRequest.idl" 1.9 + 1.10 +interface nsIInputStream; 1.11 +interface nsIOutputStream; 1.12 +interface nsIRequestObserver; 1.13 +interface nsIEventTarget; 1.14 + 1.15 +[scriptable, uuid(a5b2decf-4ede-4801-8b38-e5fe5db46bf2)] 1.16 +interface nsIAsyncStreamCopier2 : nsIRequest 1.17 +{ 1.18 + /** 1.19 + * Initialize the stream copier. 1.20 + * 1.21 + * If neither the source nor the sink are buffered, buffering will 1.22 + * be automatically added to the sink. 1.23 + * 1.24 + * 1.25 + * @param aSource 1.26 + * contains the data to be copied. 1.27 + * @param aSink 1.28 + * specifies the destination for the data. 1.29 + * @param aTarget 1.30 + * specifies the thread on which the copy will occur. a null value 1.31 + * is permitted and will cause the copy to occur on an unspecified 1.32 + * background thread. 1.33 + * @param aChunkSize 1.34 + * specifies how many bytes to read/write at a time. this controls 1.35 + * the granularity of the copying. it should match the segment size 1.36 + * of the "buffered" streams involved. 1.37 + * @param aCloseSource 1.38 + * true if aSource should be closed after copying (this is generally 1.39 + * the desired behavior). 1.40 + * @param aCloseSink 1.41 + * true if aSink should be closed after copying (this is generally 1.42 + * the desired behavior). 1.43 + */ 1.44 + void init(in nsIInputStream aSource, 1.45 + in nsIOutputStream aSink, 1.46 + in nsIEventTarget aTarget, 1.47 + in unsigned long aChunkSize, 1.48 + in boolean aCloseSource, 1.49 + in boolean aCloseSink); 1.50 + 1.51 + /** 1.52 + * asyncCopy triggers the start of the copy. The observer will be notified 1.53 + * when the copy completes. 1.54 + * 1.55 + * @param aObserver 1.56 + * receives notifications. 1.57 + * @param aObserverContext 1.58 + * passed to observer methods. 1.59 + */ 1.60 + void asyncCopy(in nsIRequestObserver aObserver, 1.61 + in nsISupports aObserverContext); 1.62 +};