# Global Metrics

path: .metrics.cognitive.sum
old: 2.0
new: 0.0
path: .metrics.cyclomatic.average
old: 1.0350877192982455
new: 1.0
path: .metrics.cyclomatic.sum
old: 59.0
new: 5.0
path: .metrics.halstead.purity_ratio
old: 1.7405944610322162
new: 2.344068073682395
path: .metrics.halstead.estimated_program_length
old: 12810.775233197111
new: 419.58818518914865
path: .metrics.halstead.level
old: 0.08452907174430466
new: 0.11797752808988764
path: .metrics.halstead.effort
old: 896058.7734374623
new: 9450.601005551416
path: .metrics.halstead.volume
old: 75743.01634700889
new: 1114.9585455987626
path: .metrics.halstead.difficulty
old: 11.830249396621078
new: 8.476190476190476
path: .metrics.halstead.length
old: 7360.0
new: 179.0
path: .metrics.halstead.n1
old: 10.0
new: 12.0
path: .metrics.halstead.vocabulary
old: 1253.0
new: 75.0
path: .metrics.halstead.bugs
old: 3.0981545335247485
new: 0.14899957535221303
path: .metrics.halstead.N1
old: 4419.0
new: 90.0
path: .metrics.halstead.N2
old: 2941.0
new: 89.0
path: .metrics.halstead.time
old: 49781.042968747905
new: 525.033389197301
path: .metrics.halstead.n2
old: 1243.0
new: 63.0
path: .metrics.loc.sloc
old: 1.0
new: 91.0
path: .metrics.loc.blank
old: 0.0
new: 18.0
path: .metrics.loc.cloc
old: 10341.0
new: 18.0
path: .metrics.loc.lloc
old: 1.0
new: 0.0
path: .metrics.loc.ploc
old: 1618.0
new: 55.0
path: .metrics.mi.mi_original
old: 99.00747206644988
new: 60.28789897171406
path: .metrics.mi.mi_visual_studio
old: 57.89910647160812
new: 35.256081270008224
path: .metrics.mi.mi_sei
old: 95.29374304074057
new: 43.57370080370611

# Spaces Data

## Minimal test - lines (24, 89)

path: .spaces[0].metrics.mi.mi_original
old: null
new: 66.1766373581941
path: .spaces[0].metrics.mi.mi_sei
old: null
new: 44.34871696483374
path: .spaces[0].metrics.mi.mi_visual_studio
old: null
new: 38.69978792876848
path: .spaces[0].metrics.halstead.level
old: null
new: 0.1139240506329114
path: .spaces[0].metrics.halstead.time
old: 0.0
new: 498.1401597997205
path: .spaces[0].metrics.halstead.effort
old: 0.0
new: 8966.522876394969
path: .spaces[0].metrics.halstead.estimated_program_length
old: null
new: 353.7834751254812
path: .spaces[0].metrics.halstead.difficulty
old: 0.0
new: 8.777777777777779
path: .spaces[0].metrics.halstead.N2
old: 1.0
new: 79.0
path: .spaces[0].metrics.halstead.vocabulary
old: 1.0
new: 66.0
path: .spaces[0].metrics.halstead.volume
old: 0.0
new: 1021.5026061715786
path: .spaces[0].metrics.halstead.n2
old: 1.0
new: 54.0
path: .spaces[0].metrics.halstead.n1
old: 0.0
new: 12.0
path: .spaces[0].metrics.halstead.bugs
old: 0.0
new: 0.1438670877772441
path: .spaces[0].metrics.halstead.N1
old: 0.0
new: 90.0
path: .spaces[0].metrics.halstead.length
old: 1.0
new: 169.0
path: .spaces[0].metrics.halstead.purity_ratio
old: null
new: 2.0933933439377586
path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 4.0
path: .spaces[0].metrics.loc.ploc
old: 1.0
new: 44.0
path: .spaces[0].metrics.loc.sloc
old: 1.0
new: 66.0
path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 7.0
path: .spaces[0].metrics.loc.blank
old: 0.0
new: 15.0

### Code

    namespace mozilla {

    class NonBlockingAsyncInputStream final : public nsIAsyncInputStream,
                                              public nsICloneableInputStream,
                                              public nsIIPCSerializableInputStream,
                                              public nsISeekableStream {
     public:
      NS_DECL_THREADSAFE_ISUPPORTS
      NS_DECL_NSIINPUTSTREAM
      NS_DECL_NSIASYNCINPUTSTREAM
      NS_DECL_NSICLONEABLEINPUTSTREAM
      NS_DECL_NSIIPCSERIALIZABLEINPUTSTREAM
      NS_DECL_NSISEEKABLESTREAM
      NS_DECL_NSITELLABLESTREAM

      // |aInputStream| must be a non-blocking, non-async inputSteam.
      static nsresult Create(already_AddRefed aInputStream,
                             nsIAsyncInputStream** aAsyncInputStream);

     private:
      explicit NonBlockingAsyncInputStream(
          already_AddRefed aInputStream);
      ~NonBlockingAsyncInputStream();

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

      class AsyncWaitRunnable;

      void RunAsyncWaitCallback(AsyncWaitRunnable* aRunnable,
                                already_AddRefed aCallback);

      nsCOMPtr mInputStream;

      // Raw pointers because these are just QI of mInputStream.
      nsICloneableInputStream* MOZ_NON_OWNING_REF mWeakCloneableInputStream;
      nsIIPCSerializableInputStream* MOZ_NON_OWNING_REF
          mWeakIPCSerializableInputStream;
      nsISeekableStream* MOZ_NON_OWNING_REF mWeakSeekableInputStream;
      nsITellableStream* MOZ_NON_OWNING_REF mWeakTellableInputStream;

      Mutex mLock;

      struct WaitClosureOnly {
        WaitClosureOnly(AsyncWaitRunnable* aRunnable, nsIEventTarget* aEventTarget);

        RefPtr mRunnable;
        nsCOMPtr mEventTarget;
      };

      // This is set when AsyncWait is called with a callback and with
      // WAIT_CLOSURE_ONLY as flag.
      // This is protected by mLock.
      Maybe mWaitClosureOnly;

      // This is protected by mLock.
      RefPtr mAsyncWaitCallback;

      // This is protected by mLock.
      bool mClosed;
    };

    }  // namespace mozilla