Bug 1426684 - Get rid of nsIMultiplexInputStream::InsertStream, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 21 Dec 2017 17:21:14 +0100
changeset 448976 93ac39966790ccf1183da04f06d16610e79cec8a
parent 448975 7401a6e3f5edcc0f350c0370aadc2597eff6fb20
child 448977 83a66733b7e55ff3700f64e6b2eae06c12f4f58e
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1426684
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1426684 - Get rid of nsIMultiplexInputStream::InsertStream, r=smaug
xpcom/io/nsIMultiplexInputStream.idl
xpcom/io/nsMultiplexInputStream.cpp
--- a/xpcom/io/nsIMultiplexInputStream.idl
+++ b/xpcom/io/nsIMultiplexInputStream.idl
@@ -22,28 +22,16 @@ interface nsIMultiplexInputStream : nsIS
      * Appends a stream to the end of the streams. The cursor of the stream
      * should be located at the beginning of the stream if the implementation
      * of this nsIMultiplexInputStream also is used as an nsISeekableStream.
      * @param stream  stream to append
      */
     void appendStream(in nsIInputStream stream);
 
     /**
-     * Insert a stream at specified index.  If the cursor of this stream is at
-     * the beginning of the stream at index, the cursor will be placed at the
-     * beginning of the inserted stream instead.
-     * The cursor of the new stream should be located at the beginning of the
-     * stream if the implementation of this nsIMultiplexInputStream also is
-     * used as an nsISeekableStream.
-     * @param stream  stream to insert
-     * @param index   index to insert stream at, must be <= count
-     */
-    void insertStream(in nsIInputStream stream, in unsigned long index);
-
-    /**
      * Remove stream at specified index. If this stream is the one currently
      * being read the readcursor is moved to the beginning of the next
      * stream
      * @param index   remove stream at this index, must be < count
      */
     void removeStream(in unsigned long index);
 
     /**
--- a/xpcom/io/nsMultiplexInputStream.cpp
+++ b/xpcom/io/nsMultiplexInputStream.cpp
@@ -226,40 +226,16 @@ nsMultiplexInputStream::AppendStream(nsI
     // We were closed, but now we have more data to read.
     mStatus = NS_OK;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsMultiplexInputStream::InsertStream(nsIInputStream* aStream, uint32_t aIndex)
-{
-  MutexAutoLock lock(mLock);
-
-  StreamData* streamData = mStreams.InsertElementAt(aIndex);
-  if (NS_WARN_IF(!streamData)) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-
-  streamData->Initialize(aStream);
-
-  if (mCurrentStream > aIndex ||
-      (mCurrentStream == aIndex && mStartedReadingCurrent)) {
-    ++mCurrentStream;
-  } else if (mStatus == NS_BASE_STREAM_CLOSED) {
-    // We were closed, but now we have more data to read.
-    mStatus = NS_OK;
-  }
-
-  UpdateQIMap(*streamData, 1);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 nsMultiplexInputStream::RemoveStream(uint32_t aIndex)
 {
   MutexAutoLock lock(mLock);
   if (aIndex >= mStreams.Length()) {
     return NS_ERROR_FAILURE;
   }
 
   UpdateQIMap(mStreams[aIndex], -1);