netwerk/base/public/nsIInputStreamPump.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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 nsIStreamListener;
michael@0 9
michael@0 10 /**
michael@0 11 * nsIInputStreamPump
michael@0 12 *
michael@0 13 * This interface provides a means to configure and use a input stream pump
michael@0 14 * instance. The input stream pump will asynchronously read from an input
michael@0 15 * stream, and push data to an nsIStreamListener instance. It utilizes the
michael@0 16 * current thread's nsIEventTarget in order to make reading from the stream
michael@0 17 * asynchronous. A different thread can be used if the pump also implements
michael@0 18 * nsIThreadRetargetableRequest.
michael@0 19 *
michael@0 20 * If the given stream supports nsIAsyncInputStream, then the stream pump will
michael@0 21 * call the stream's AsyncWait method to drive the stream listener. Otherwise,
michael@0 22 * the stream will be read on a background thread utilizing the stream
michael@0 23 * transport service. More details are provided below.
michael@0 24 */
michael@0 25 [scriptable, uuid(400F5468-97E7-4d2b-9C65-A82AECC7AE82)]
michael@0 26 interface nsIInputStreamPump : nsIRequest
michael@0 27 {
michael@0 28 /**
michael@0 29 * Initialize the input stream pump.
michael@0 30 *
michael@0 31 * @param aStream
michael@0 32 * contains the data to be read. if the input stream is non-blocking,
michael@0 33 * then it will be QI'd to nsIAsyncInputStream. if the QI succeeds
michael@0 34 * then the stream will be read directly. otherwise, it will be read
michael@0 35 * on a background thread using the stream transport service.
michael@0 36 * @param aStreamPos
michael@0 37 * specifies the stream offset from which to start reading. the
michael@0 38 * offset value is absolute. pass -1 to specify the current offset.
michael@0 39 * NOTE: this parameter is ignored if the underlying stream does not
michael@0 40 * implement nsISeekableStream.
michael@0 41 * @param aStreamLen
michael@0 42 * specifies how much data to read from the stream. pass -1 to read
michael@0 43 * all data available in the stream.
michael@0 44 * @param aSegmentSize
michael@0 45 * if the stream transport service is used, then this parameter
michael@0 46 * specifies the segment size for the stream transport's buffer.
michael@0 47 * pass 0 to specify the default value.
michael@0 48 * @param aSegmentCount
michael@0 49 * if the stream transport service is used, then this parameter
michael@0 50 * specifies the segment count for the stream transport's buffer.
michael@0 51 * pass 0 to specify the default value.
michael@0 52 * @param aCloseWhenDone
michael@0 53 * if true, the input stream will be closed after it has been read.
michael@0 54 */
michael@0 55 void init(in nsIInputStream aStream,
michael@0 56 in long long aStreamPos,
michael@0 57 in long long aStreamLen,
michael@0 58 in unsigned long aSegmentSize,
michael@0 59 in unsigned long aSegmentCount,
michael@0 60 in boolean aCloseWhenDone);
michael@0 61
michael@0 62 /**
michael@0 63 * asyncRead causes the input stream to be read in chunks and delivered
michael@0 64 * asynchronously to the listener via OnDataAvailable.
michael@0 65 *
michael@0 66 * @param aListener
michael@0 67 * receives notifications.
michael@0 68 * @param aListenerContext
michael@0 69 * passed to listener methods.
michael@0 70 */
michael@0 71 void asyncRead(in nsIStreamListener aListener,
michael@0 72 in nsISupports aListenerContext);
michael@0 73 };

mercurial