# Global Metrics

path: .metrics.nargs.sum
old: 24.0
new: 0.0
path: .metrics.nargs.average
old: 0.631578947368421
new: null
path: .metrics.cognitive.average
old: 0.10526315789473684
new: null
path: .metrics.cognitive.sum
old: 4.0
new: 0.0
path: .metrics.cyclomatic.sum
old: 53.0
new: 2.0
path: .metrics.cyclomatic.average
old: 1.2325581395348837
new: 1.0
path: .metrics.nexits.sum
old: 28.0
new: 0.0
path: .metrics.nexits.average
old: 0.7368421052631579
new: null
path: .metrics.halstead.n2
old: 31.0
new: 53.0
path: .metrics.halstead.difficulty
old: 138.48387096774192
new: 6.90566037735849
path: .metrics.halstead.length
old: 843.0
new: 140.0
path: .metrics.halstead.n1
old: 27.0
new: 12.0
path: .metrics.halstead.purity_ratio
old: 0.3344745530016688
new: 2.4757095292893103
path: .metrics.halstead.N1
old: 525.0
new: 79.0
path: .metrics.halstead.level
old: 0.007221057535522945
new: 0.1448087431693989
path: .metrics.halstead.vocabulary
old: 58.0
new: 65.0
path: .metrics.halstead.N2
old: 318.0
new: 61.0
path: .metrics.halstead.estimated_program_length
old: 281.9620481804068
new: 346.5993341005034
path: .metrics.halstead.time
old: 37992.88057954424
new: 323.46554165574213
path: .metrics.halstead.bugs
old: 2.5873900103337553
new: 0.10788119880240292
path: .metrics.halstead.volume
old: 4938.277978892543
new: 843.1314938239836
path: .metrics.halstead.effort
old: 683871.8504317963
new: 5822.379749803358
path: .metrics.mi.mi_original
old: 25.267640108985844
new: 55.92195162016368
path: .metrics.mi.mi_visual_studio
old: 14.776397724553124
new: 32.70289568430625
path: .metrics.mi.mi_sei
old: -2.3508619400511748
new: 50.17193130042487
path: .metrics.nom.functions
old: 38.0
new: 0.0
path: .metrics.nom.total
old: 38.0
new: 0.0
path: .metrics.loc.lloc
old: 44.0
new: 0.0
path: .metrics.loc.sloc
old: 248.0
new: 136.0
path: .metrics.loc.blank
old: 44.0
new: 13.0
path: .metrics.loc.cloc
old: 48.0
new: 71.0
path: .metrics.loc.ploc
old: 156.0
new: 52.0

# Spaces Data

## Minimal test - lines (22, 134)

path: .spaces[0].metrics.nom.total
old: 36.0
new: 0.0
path: .spaces[0].metrics.nom.functions
old: 36.0
new: 0.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.25
new: 1.0
path: .spaces[0].metrics.cyclomatic.sum
old: 50.0
new: 1.0
path: .spaces[0].metrics.halstead.bugs
old: 2.5871388246717792
new: 0.10017744822848294
path: .spaces[0].metrics.halstead.level
old: 0.00655076845553036
new: 0.14379084967320263
path: .spaces[0].metrics.halstead.difficulty
old: 152.65384615384616
new: 6.954545454545454
path: .spaces[0].metrics.halstead.n1
old: 27.0
new: 12.0
path: .spaces[0].metrics.halstead.n2
old: 26.0
new: 44.0
path: .spaces[0].metrics.halstead.vocabulary
old: 53.0
new: 56.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 250.593395230082
new: 283.2345412286949
path: .spaces[0].metrics.halstead.effort
old: 683772.2667005449
new: 5209.989277120496
path: .spaces[0].metrics.halstead.volume
old: 4479.233795468422
new: 749.1487849454309
path: .spaces[0].metrics.halstead.N1
old: 488.0
new: 78.0
path: .spaces[0].metrics.halstead.length
old: 782.0
new: 129.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 0.3204519120589284
new: 2.1956165986720535
path: .spaces[0].metrics.halstead.time
old: 37987.34815003027
new: 289.44384872891646
path: .spaces[0].metrics.halstead.N2
old: 294.0
new: 51.0
path: .spaces[0].metrics.nargs.sum
old: 20.0
new: 0.0
path: .spaces[0].metrics.nargs.average
old: 0.5555555555555556
new: null
path: .spaces[0].metrics.nexits.sum
old: 26.0
new: 0.0
path: .spaces[0].metrics.nexits.average
old: 0.7222222222222222
new: null
path: .spaces[0].metrics.cognitive.sum
old: 4.0
new: 0.0
path: .spaces[0].metrics.cognitive.average
old: 0.1111111111111111
new: null
path: .spaces[0].metrics.loc.ploc
old: 140.0
new: 41.0
path: .spaces[0].metrics.loc.lloc
old: 42.0
new: 0.0
path: .spaces[0].metrics.loc.blank
old: 38.0
new: 10.0
path: .spaces[0].metrics.loc.cloc
old: 40.0
new: 62.0
path: .spaces[0].metrics.loc.sloc
old: 218.0
new: 113.0
path: .spaces[0].metrics.mi.mi_sei
old: 1.382327383470102
new: 56.21524853504389
path: .spaces[0].metrics.mi.mi_original
old: 28.55370211129538
new: 59.76784177226013
path: .spaces[0].metrics.mi.mi_visual_studio
old: 16.698071410114256
new: 34.9519542527837

### Code

    class nsBaseAppShell : public nsIAppShell,
                           public nsIThreadObserver,
                           public nsIObserver {
     public:
      NS_DECL_THREADSAFE_ISUPPORTS
      NS_DECL_NSIAPPSHELL

      NS_DECL_NSITHREADOBSERVER
      NS_DECL_NSIOBSERVER

      nsBaseAppShell();

     protected:
      virtual ~nsBaseAppShell();

      /**
       * This method is called by subclasses when the app shell singleton is
       * instantiated.
       */
      nsresult Init();

      /**
       * Called by subclasses from a native event. See ScheduleNativeEventCallback.
       */
      void NativeEventCallback();

      /**
       * Make a decision as to whether or not NativeEventCallback will
       * trigger gecko event processing when there are pending gecko
       * events.
       */
      virtual void DoProcessMoreGeckoEvents();

      /**
       * Implemented by subclasses.  Invoke NativeEventCallback from a native
       * event.  This method may be called on any thread.
       */
      virtual void ScheduleNativeEventCallback() = 0;

      /**
       * Implemented by subclasses.  Process the next native event.  Only wait for
       * the next native event if mayWait is true.  This method is only called on
       * the main application thread.
       *
       * @param mayWait
       *   If "true", then this method may wait if necessary for the next available
       *   native event.  DispatchNativeEvent may be called to unblock a call to
       *   ProcessNextNativeEvent that is waiting.
       * @return
       *   This method returns "true" if a native event was processed.
       */
      virtual bool ProcessNextNativeEvent(bool mayWait) = 0;

      int32_t mSuspendNativeCount;
      uint32_t mEventloopNestingLevel;

     private:
      bool DoProcessNextNativeEvent(bool mayWait);

      bool DispatchDummyEvent(nsIThread* target);

      void IncrementEventloopNestingLevel();
      void DecrementEventloopNestingLevel();

      nsCOMPtr mDummyEvent;
      /**
       * mBlockedWait points back to a slot that controls the wait loop in
       * an outer OnProcessNextEvent invocation.  Nested calls always set
       * it to false to unblock an outer loop, since all events may
       * have been consumed by the inner event loop(s).
       */
      bool* mBlockedWait;
      int32_t mFavorPerf;
      mozilla::Atomic mNativeEventPending;
      PRIntervalTime mStarvationDelay;
      PRIntervalTime mSwitchTime;
      PRIntervalTime mLastNativeEventTime;
      enum EventloopNestingState {
        eEventloopNone,   // top level thread execution
        eEventloopXPCOM,  // innermost native event loop is ProcessNextNativeEvent
        eEventloopOther   // innermost native event loop is a native library/plugin
                          // etc
      };
      EventloopNestingState mEventloopNestingState;
      bool mRunning;
      bool mExiting;
      /**
       * mBlockNativeEvent blocks the appshell from processing native events.
       * It is set to true while a nested native event loop (eEventloopOther)
       * is processing gecko events in NativeEventCallback(), thus queuing up
       * native events until we return to that loop (bug 420148).
       * We force mBlockNativeEvent to false in case handling one of the gecko
       * events spins up a nested XPCOM event loop (eg. modal window) which would
       * otherwise lead to a "deadlock" where native events aren't processed at all.
       */
      bool mBlockNativeEvent;
      /**
       * Tracks whether we have processed any gecko events in NativeEventCallback so
       * that we can avoid erroneously entering a blocking loop waiting for gecko
       * events to show up during OnProcessNextEvent.  This is required because on
       * OS X ProcessGeckoEvents may be invoked inside the context of
       * ProcessNextNativeEvent and may result in NativeEventCallback being invoked
       * and in turn invoking NS_ProcessPendingEvents.  Because
       * ProcessNextNativeEvent may be invoked prior to the NS_HasPendingEvents
       * waiting loop, this is the only way to make the loop aware that events may
       * have been processed.
       *
       * This variable is set to false in OnProcessNextEvent prior to the first
       * call to DoProcessNextNativeEvent.  It is set to true by
       * NativeEventCallback after calling NS_ProcessPendingEvents.
       */
      bool mProcessedGeckoEvents;
    };