# Global Metrics

path: .metrics.loc.ploc
old: 74.0
new: 274.0
path: .metrics.loc.cloc
old: 95.0
new: 18.0
path: .metrics.loc.blank
old: 32.0
new: 71.0
path: .metrics.loc.lloc
old: 0.0
new: 112.0
path: .metrics.loc.sloc
old: 201.0
new: 363.0
path: .metrics.nargs.average
old: 0.5
new: 2.090909090909091
path: .metrics.nargs.sum
old: 2.0
new: 46.0
path: .metrics.nexits.sum
old: 0.0
new: 25.0
path: .metrics.nexits.average
old: 0.0
new: 1.1363636363636365
path: .metrics.cognitive.sum
old: 0.0
new: 28.0
path: .metrics.cognitive.average
old: 0.0
new: 1.2727272727272727
path: .metrics.halstead.N1
old: 143.0
new: 679.0
path: .metrics.halstead.N2
old: 102.0
new: 501.0
path: .metrics.halstead.n2
old: 61.0
new: 134.0
path: .metrics.halstead.length
old: 245.0
new: 1180.0
path: .metrics.halstead.vocabulary
old: 76.0
new: 158.0
path: .metrics.halstead.volume
old: 1530.7422407936783
new: 8618.46128284898
path: .metrics.halstead.bugs
old: 0.2389834665848911
new: 1.7691908487568369
path: .metrics.halstead.purity_ratio
old: 1.7158299450018932
new: 0.8956737724903806
path: .metrics.halstead.level
old: 0.07973856209150326
new: 0.022288755821689953
path: .metrics.halstead.estimated_program_length
old: 420.37833652546385
new: 1056.895051538649
path: .metrics.halstead.effort
old: 19197.013347658427
new: 386673.0539737916
path: .metrics.halstead.n1
old: 15.0
new: 24.0
path: .metrics.halstead.time
old: 1066.5007415365792
new: 21481.83633187731
path: .metrics.halstead.difficulty
old: 12.540983606557376
new: 44.865671641791046
path: .metrics.nom.total
old: 4.0
new: 22.0
path: .metrics.nom.functions
old: 4.0
new: 22.0
path: .metrics.cyclomatic.sum
old: 12.0
new: 51.0
path: .metrics.cyclomatic.average
old: 1.0909090909090908
new: 2.125
path: .metrics.mi.mi_original
old: 44.1922187778859
new: 16.660032505189733
path: .metrics.mi.mi_visual_studio
old: 25.84340279408532
new: 9.742709067362416
path: .metrics.mi.mi_sei
old: 33.01750305461307
new: -29.56400032990724

# Spaces Data

## Minimal test - lines (12, 363)

path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 28.0
path: .spaces[0].metrics.cognitive.average
old: 0.0
new: 1.2727272727272727
path: .spaces[0].metrics.nom.functions
old: 4.0
new: 22.0
path: .spaces[0].metrics.nom.total
old: 4.0
new: 22.0
path: .spaces[0].metrics.nargs.sum
old: 2.0
new: 46.0
path: .spaces[0].metrics.nargs.average
old: 0.5
new: 2.090909090909091
path: .spaces[0].metrics.loc.blank
old: 29.0
new: 70.0
path: .spaces[0].metrics.loc.ploc
old: 63.0
new: 270.0
path: .spaces[0].metrics.loc.cloc
old: 88.0
new: 12.0
path: .spaces[0].metrics.loc.sloc
old: 180.0
new: 352.0
path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 112.0
path: .spaces[0].metrics.mi.mi_original
old: 46.40411779660957
new: 17.432595764759043
path: .spaces[0].metrics.mi.mi_sei
old: 36.539354007083006
new: -31.352230879204228
path: .spaces[0].metrics.mi.mi_visual_studio
old: 27.13691099216934
new: 10.194500447227512
path: .spaces[0].metrics.halstead.time
old: 1034.8154914699735
new: 21780.68340006682
path: .spaces[0].metrics.halstead.level
old: 0.07916666666666666
new: 0.021797451374916163
path: .spaces[0].metrics.halstead.effort
old: 18626.678846459527
new: 392052.3012012028
path: .spaces[0].metrics.halstead.n1
old: 15.0
new: 24.0
path: .spaces[0].metrics.halstead.length
old: 239.0
new: 1176.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.6363099989184855
new: 0.8698528194821487
path: .spaces[0].metrics.halstead.N2
old: 96.0
new: 497.0
path: .spaces[0].metrics.halstead.N1
old: 143.0
new: 679.0
path: .spaces[0].metrics.halstead.vocabulary
old: 72.0
new: 154.0
path: .spaces[0].metrics.halstead.difficulty
old: 12.63157894736842
new: 45.87692307692308
path: .spaces[0].metrics.halstead.volume
old: 1474.6120753447126
new: 8545.740971857203
path: .spaces[0].metrics.halstead.bugs
old: 0.23422632069460053
new: 1.785561241022543
path: .spaces[0].metrics.halstead.n2
old: 57.0
new: 130.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 391.07808974151806
new: 1022.9469157110068
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 25.0
path: .spaces[0].metrics.nexits.average
old: 0.0
new: 1.1363636363636365
path: .spaces[0].metrics.cyclomatic.average
old: 1.1
new: 2.1739130434782608
path: .spaces[0].metrics.cyclomatic.sum
old: 11.0
new: 50.0

### Code

    namespace mozilla {

    using namespace ipc;

    NS_IMPL_ADDREF(InputStreamLengthWrapper);
    NS_IMPL_RELEASE(InputStreamLengthWrapper);

    NS_INTERFACE_MAP_BEGIN(InputStreamLengthWrapper)
      NS_INTERFACE_MAP_ENTRY(nsIInputStream)
      NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsICloneableInputStream,
                                         mWeakCloneableInputStream || !mInputStream)
      NS_INTERFACE_MAP_ENTRY_CONDITIONAL(
          nsIIPCSerializableInputStream,
          mWeakIPCSerializableInputStream || !mInputStream)
      NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsISeekableStream,
                                         mWeakSeekableInputStream || !mInputStream)
      NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsITellableStream,
                                         mWeakTellableInputStream || !mInputStream)
      NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIAsyncInputStream,
                                         mWeakAsyncInputStream || !mInputStream)
      NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIInputStreamCallback,
                                         mWeakAsyncInputStream || !mInputStream)
      NS_INTERFACE_MAP_ENTRY(nsIInputStreamLength)
      NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInputStream)
    NS_INTERFACE_MAP_END

    /* static */
    already_AddRefed InputStreamLengthWrapper::MaybeWrap(
        already_AddRefed aInputStream, int64_t aLength) {
      nsCOMPtr inputStream = std::move(aInputStream);
      MOZ_ASSERT(inputStream);

      nsCOMPtr length = do_QueryInterface(inputStream);
      if (length) {
        return inputStream.forget();
      }

      nsCOMPtr asyncLength =
          do_QueryInterface(inputStream);
      if (asyncLength) {
        return inputStream.forget();
      }

      nsCOMPtr asyncStream = do_QueryInterface(inputStream);
      if (!asyncStream) {
        return inputStream.forget();
      }

      inputStream = new InputStreamLengthWrapper(inputStream.forget(), aLength);
      return inputStream.forget();
    }

    InputStreamLengthWrapper::InputStreamLengthWrapper(
        already_AddRefed aInputStream, int64_t aLength)
        : mWeakCloneableInputStream(nullptr),
          mWeakIPCSerializableInputStream(nullptr),
          mWeakSeekableInputStream(nullptr),
          mWeakTellableInputStream(nullptr),
          mWeakAsyncInputStream(nullptr),
          mLength(aLength),
          mConsumed(false),
          mMutex("InputStreamLengthWrapper::mMutex") {
      MOZ_ASSERT(mLength >= 0);

      nsCOMPtr inputStream = std::move(aInputStream);
      SetSourceStream(inputStream.forget());
    }

    InputStreamLengthWrapper::InputStreamLengthWrapper()
        : mWeakCloneableInputStream(nullptr),
          mWeakIPCSerializableInputStream(nullptr),
          mWeakSeekableInputStream(nullptr),
          mWeakTellableInputStream(nullptr),
          mWeakAsyncInputStream(nullptr),
          mLength(-1),
          mConsumed(false),
          mMutex("InputStreamLengthWrapper::mMutex") {}

    InputStreamLengthWrapper::~InputStreamLengthWrapper() = default;

    void InputStreamLengthWrapper::SetSourceStream(
        already_AddRefed aInputStream) {
      MOZ_ASSERT(!mInputStream);

      mInputStream = std::move(aInputStream);

      nsCOMPtr cloneableStream =
          do_QueryInterface(mInputStream);
      if (cloneableStream && SameCOMIdentity(mInputStream, cloneableStream)) {
        mWeakCloneableInputStream = cloneableStream;
      }

      nsCOMPtr serializableStream =
          do_QueryInterface(mInputStream);
      if (serializableStream && SameCOMIdentity(mInputStream, serializableStream)) {
        mWeakIPCSerializableInputStream = serializableStream;
      }

      nsCOMPtr seekableStream = do_QueryInterface(mInputStream);
      if (seekableStream && SameCOMIdentity(mInputStream, seekableStream)) {
        mWeakSeekableInputStream = seekableStream;
      }

      nsCOMPtr tellableStream = do_QueryInterface(mInputStream);
      if (tellableStream && SameCOMIdentity(mInputStream, tellableStream)) {
        mWeakTellableInputStream = tellableStream;
      }

      nsCOMPtr asyncInputStream =
          do_QueryInterface(mInputStream);
      if (asyncInputStream && SameCOMIdentity(mInputStream, asyncInputStream)) {
        mWeakAsyncInputStream = asyncInputStream;
      }
    }

    // nsIInputStream interface

    NS_IMETHODIMP
    InputStreamLengthWrapper::Close() {
      NS_ENSURE_STATE(mInputStream);
      return mInputStream->Close();
    }

    NS_IMETHODIMP
    InputStreamLengthWrapper::Available(uint64_t* aLength) {
      NS_ENSURE_STATE(mInputStream);
      return mInputStream->Available(aLength);
    }

    NS_IMETHODIMP
    InputStreamLengthWrapper::Read(char* aBuffer, uint32_t aCount,
                                   uint32_t* aReadCount) {
      NS_ENSURE_STATE(mInputStream);
      mConsumed = true;
      return mInputStream->Read(aBuffer, aCount, aReadCount);
    }

    NS_IMETHODIMP
    InputStreamLengthWrapper::ReadSegments(nsWriteSegmentFun aWriter,
                                           void* aClosure, uint32_t aCount,
                                           uint32_t* aResult) {
      return NS_ERROR_NOT_IMPLEMENTED;
    }

    NS_IMETHODIMP
    InputStreamLengthWrapper::IsNonBlocking(bool* aNonBlocking) {
      NS_ENSURE_STATE(mInputStream);
      return mInputStream->IsNonBlocking(aNonBlocking);
    }

    // nsICloneableInputStream interface

    NS_IMETHODIMP
    InputStreamLengthWrapper::GetCloneable(bool* aCloneable) {
      NS_ENSURE_STATE(mInputStream);
      NS_ENSURE_STATE(mWeakCloneableInputStream);
      mWeakCloneableInputStream->GetCloneable(aCloneable);
      return NS_OK;
    }

    NS_IMETHODIMP
    InputStreamLengthWrapper::Clone(nsIInputStream** aResult) {
      NS_ENSURE_STATE(mInputStream);
      NS_ENSURE_STATE(mWeakCloneableInputStream);

      nsCOMPtr clonedStream;
      nsresult rv = mWeakCloneableInputStream->Clone(getter_AddRefs(clonedStream));
      if (NS_WARN_IF(NS_FAILED(rv))) {
        return rv;
      }

      nsCOMPtr stream =
          new InputStreamLengthWrapper(clonedStream.forget(), mLength);

      stream.forget(aResult);
      return NS_OK;
    }

    // nsIAsyncInputStream interface

    NS_IMETHODIMP
    InputStreamLengthWrapper::CloseWithStatus(nsresult aStatus) {
      NS_ENSURE_STATE(mInputStream);
      NS_ENSURE_STATE(mWeakAsyncInputStream);

      mConsumed = true;
      return mWeakAsyncInputStream->CloseWithStatus(aStatus);
    }

    NS_IMETHODIMP
    InputStreamLengthWrapper::AsyncWait(nsIInputStreamCallback* aCallback,
                                        uint32_t aFlags, uint32_t aRequestedCount,
                                        nsIEventTarget* aEventTarget) {
      NS_ENSURE_STATE(mInputStream);
      NS_ENSURE_STATE(mWeakAsyncInputStream);

      nsCOMPtr callback = this;
      {
        MutexAutoLock lock(mMutex);

        if (mAsyncWaitCallback && aCallback) {
          return NS_ERROR_FAILURE;
        }

        bool hadCallback = !!mAsyncWaitCallback;
        mAsyncWaitCallback = aCallback;

        if (!mAsyncWaitCallback) {
          if (!hadCallback) {
            // No pending operation.
            return NS_OK;
          }

          // Abort current operation.
          callback = nullptr;
        }
      }

      return mWeakAsyncInputStream->AsyncWait(callback, aFlags, aRequestedCount,
                                              aEventTarget);
    }

    // nsIInputStreamCallback

    NS_IMETHODIMP
    InputStreamLengthWrapper::OnInputStreamReady(nsIAsyncInputStream* aStream) {
      MOZ_ASSERT(mInputStream);
      MOZ_ASSERT(mWeakAsyncInputStream);
      MOZ_ASSERT(mWeakAsyncInputStream == aStream);

      nsCOMPtr callback;
      {
        MutexAutoLock lock(mMutex);
        // We have been canceled in the meanwhile.
        if (!mAsyncWaitCallback) {
          return NS_OK;
        }

        callback.swap(mAsyncWaitCallback);
      }

      MOZ_ASSERT(callback);
      return callback->OnInputStreamReady(this);
    }

    // nsIIPCSerializableInputStream

    void InputStreamLengthWrapper::Serialize(
        mozilla::ipc::InputStreamParams& aParams,
        FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
        uint32_t aMaxSize, uint32_t* aSizeUsed,
        mozilla::ipc::ParentToChildStreamActorManager* aManager) {
      SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
                        aSizeUsed, aManager);
    }

    void InputStreamLengthWrapper::Serialize(
        mozilla::ipc::InputStreamParams& aParams,
        FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
        uint32_t aMaxSize, uint32_t* aSizeUsed,
        mozilla::ipc::ChildToParentStreamActorManager* aManager) {
      SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
                        aSizeUsed, aManager);
    }

    template
    void InputStreamLengthWrapper::SerializeInternal(
        mozilla::ipc::InputStreamParams& aParams,
        FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
        uint32_t aMaxSize, uint32_t* aSizeUsed, M* aManager) {
      MOZ_ASSERT(mInputStream);
      MOZ_ASSERT(mWeakIPCSerializableInputStream);

      InputStreamLengthWrapperParams params;
      InputStreamHelper::SerializeInputStream(mInputStream, params.stream(),
                                              aFileDescriptors, aDelayedStart,
                                              aMaxSize, aSizeUsed, aManager);
      params.length() = mLength;
      params.consumed() = mConsumed;

      aParams = params;
    }

    bool InputStreamLengthWrapper::Deserialize(
        const mozilla::ipc::InputStreamParams& aParams,
        const FileDescriptorArray& aFileDescriptors) {
      MOZ_ASSERT(!mInputStream);
      MOZ_ASSERT(!mWeakIPCSerializableInputStream);

      if (aParams.type() != InputStreamParams::TInputStreamLengthWrapperParams) {
        NS_ERROR("Received unknown parameters from the other process!");
        return false;
      }

      const InputStreamLengthWrapperParams& params =
          aParams.get_InputStreamLengthWrapperParams();

      nsCOMPtr stream = InputStreamHelper::DeserializeInputStream(
          params.stream(), aFileDescriptors);
      if (!stream) {
        NS_WARNING("Deserialize failed!");
        return false;
      }

      SetSourceStream(stream.forget());

      mLength = params.length();
      mConsumed = params.consumed();

      return true;
    }

    // nsISeekableStream

    NS_IMETHODIMP
    InputStreamLengthWrapper::Seek(int32_t aWhence, int64_t aOffset) {
      NS_ENSURE_STATE(mInputStream);
      NS_ENSURE_STATE(mWeakSeekableInputStream);

      mConsumed = true;
      return mWeakSeekableInputStream->Seek(aWhence, aOffset);
    }

    NS_IMETHODIMP
    InputStreamLengthWrapper::SetEOF() {
      NS_ENSURE_STATE(mInputStream);
      NS_ENSURE_STATE(mWeakSeekableInputStream);

      mConsumed = true;
      return mWeakSeekableInputStream->SetEOF();
    }

    // nsITellableStream

    NS_IMETHODIMP
    InputStreamLengthWrapper::Tell(int64_t* aResult) {
      NS_ENSURE_STATE(mInputStream);
      NS_ENSURE_STATE(mWeakTellableInputStream);

      return mWeakTellableInputStream->Tell(aResult);
    }

    // nsIInputStreamLength

    NS_IMETHODIMP
    InputStreamLengthWrapper::Length(int64_t* aLength) {
      NS_ENSURE_STATE(mInputStream);
      *aLength = mLength;
      return NS_OK;
    }

    }  // namespace mozilla

## Minimal test - lines (39, 62)

path: .spaces[0].spaces[0].metrics.cognitive.average
old: null
new: 3.0
path: .spaces[0].spaces[0].metrics.cognitive.sum
old: 0.0
new: 3.0
path: .spaces[0].spaces[0].metrics.halstead.level
old: null
new: 0.05714285714285714
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 0.0
new: 14.0
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 1.0
new: 32.0
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 0.0
new: 17.5
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.0
new: 0.15082705019460738
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 0.0
new: 65.0
path: .spaces[0].spaces[0].metrics.halstead.length
old: 1.0
new: 110.0
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 1.0
new: 18.0
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 0.0
new: 550.0
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 1.0
new: 45.0
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: null
new: 1.1669238084978917
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 0.0
new: 9625.0
path: .spaces[0].spaces[0].metrics.halstead.time
old: 0.0
new: 534.7222222222222
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: null
new: 128.36161893476807
path: .spaces[0].spaces[0].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].metrics.nexits.sum
old: 0.0
new: 4.0
path: .spaces[0].spaces[0].metrics.nexits.average
old: null
new: 4.0
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 1.0
new: 24.0
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 1.0
new: 20.0
path: .spaces[0].spaces[0].metrics.loc.lloc
old: 0.0
new: 9.0
path: .spaces[0].spaces[0].metrics.loc.blank
old: 0.0
new: 4.0
path: .spaces[0].spaces[0].metrics.cyclomatic.average
old: 1.0
new: 4.0
path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 4.0
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: null
new: 50.16605432841252
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: null
new: 48.46651088457476
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: null
new: 85.78395290158542
path: .spaces[0].spaces[0].metrics.nargs.sum
old: 0.0
new: 2.0
path: .spaces[0].spaces[0].metrics.nargs.average
old: null
new: 2.0

### Code

    already_AddRefed InputStreamLengthWrapper::MaybeWrap(
        already_AddRefed aInputStream, int64_t aLength) {
      nsCOMPtr inputStream = std::move(aInputStream);
      MOZ_ASSERT(inputStream);

      nsCOMPtr length = do_QueryInterface(inputStream);
      if (length) {
        return inputStream.forget();
      }

      nsCOMPtr asyncLength =
          do_QueryInterface(inputStream);
      if (asyncLength) {
        return inputStream.forget();
      }

      nsCOMPtr asyncStream = do_QueryInterface(inputStream);
      if (!asyncStream) {
        return inputStream.forget();
      }

      inputStream = new InputStreamLengthWrapper(inputStream.forget(), aLength);
      return inputStream.forget();
    }

## Minimal test - lines (64, 78)

path: .spaces[0].spaces[1].metrics.nargs.average
old: 0.5
new: 2.0
path: .spaces[0].spaces[1].metrics.cyclomatic.sum
old: 9.0
new: 1.0
path: .spaces[0].spaces[1].metrics.cyclomatic.average
old: 1.125
new: 1.0
path: .spaces[0].spaces[1].metrics.halstead.length
old: 234.0
new: 68.0
path: .spaces[0].spaces[1].metrics.halstead.N1
old: 140.0
new: 36.0
path: .spaces[0].spaces[1].metrics.halstead.purity_ratio
old: 1.640236045168178
new: 2.1626687499700763
path: .spaces[0].spaces[1].metrics.halstead.level
old: 0.07943262411347518
new: 0.11979166666666669
path: .spaces[0].spaces[1].metrics.halstead.bugs
old: 0.2299295990737218
new: 0.06796803650515304
path: .spaces[0].spaces[1].metrics.halstead.volume
old: 1439.0408259640956
new: 348.7912451522577
path: .spaces[0].spaces[1].metrics.halstead.n1
old: 15.0
new: 12.0
path: .spaces[0].spaces[1].metrics.halstead.effort
old: 18116.496112583704
new: 2911.6486551840644
path: .spaces[0].spaces[1].metrics.halstead.estimated_program_length
old: 383.8152345693536
new: 147.06147499796518
path: .spaces[0].spaces[1].metrics.halstead.vocabulary
old: 71.0
new: 35.0
path: .spaces[0].spaces[1].metrics.halstead.n2
old: 56.0
new: 23.0
path: .spaces[0].spaces[1].metrics.halstead.difficulty
old: 12.589285714285714
new: 8.347826086956522
path: .spaces[0].spaces[1].metrics.halstead.N2
old: 94.0
new: 32.0
path: .spaces[0].spaces[1].metrics.halstead.time
old: 1006.4720062546502
new: 161.75825862133692
path: .spaces[0].spaces[1].metrics.nom.total
old: 4.0
new: 1.0
path: .spaces[0].spaces[1].metrics.nom.functions
old: 4.0
new: 1.0
path: .spaces[0].spaces[1].metrics.loc.lloc
old: 0.0
new: 2.0
path: .spaces[0].spaces[1].metrics.loc.cloc
old: 87.0
new: 0.0
path: .spaces[0].spaces[1].metrics.loc.sloc
old: 172.0
new: 15.0
path: .spaces[0].spaces[1].metrics.loc.blank
old: 25.0
new: 1.0
path: .spaces[0].spaces[1].metrics.loc.ploc
old: 60.0
new: 14.0
path: .spaces[0].spaces[1].metrics.mi.mi_sei
old: 38.67289301098203
new: 63.5580282579424
path: .spaces[0].spaces[1].metrics.mi.mi_original
old: 47.72758267235686
new: 96.45632406472026
path: .spaces[0].spaces[1].metrics.mi.mi_visual_studio
old: 27.91086705985781
new: 56.40720705539197

### Code

    InputStreamLengthWrapper::InputStreamLengthWrapper(
        already_AddRefed aInputStream, int64_t aLength)
        : mWeakCloneableInputStream(nullptr),
          mWeakIPCSerializableInputStream(nullptr),
          mWeakSeekableInputStream(nullptr),
          mWeakTellableInputStream(nullptr),
          mWeakAsyncInputStream(nullptr),
          mLength(aLength),
          mConsumed(false),
          mMutex("InputStreamLengthWrapper::mMutex") {
      MOZ_ASSERT(mLength >= 0);

      nsCOMPtr inputStream = std::move(aInputStream);
      SetSourceStream(inputStream.forget());
    }