tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsIAsyncStreamCopier2.idl (2137B)


      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/. */
      4 
      5 #include "nsIRequest.idl"
      6 
      7 interface nsIInputStream;
      8 interface nsIOutputStream;
      9 interface nsIRequestObserver;
     10 interface nsIEventTarget;
     11 
     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);
     47 
     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 };