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

     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
    14 {
    15     /**
    16      * Initialize the stream copier.
    17      *
    18      * If neither the source nor the sink are buffered, buffering will
    19      * be automatically added to the sink.
    20      *
    21      *
    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).
    40      */
    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.
    51    *
    52    * @param aObserver
    53    *        receives notifications.
    54    * @param aObserverContext
    55    *        passed to observer methods.
    56    */
    57   void asyncCopy(in nsIRequestObserver   aObserver,
    58                  in nsISupports          aObserverContext);
    59 };

mercurial