# Global Metrics

path: .metrics.cyclomatic.average
old: 1.0
new: 2.5789473684210527
path: .metrics.cyclomatic.sum
old: 6.0
new: 49.0
path: .metrics.nargs.average
old: 0.0
new: 0.7777777777777778
path: .metrics.nargs.sum
old: 0.0
new: 14.0
path: .metrics.halstead.length
old: 350.0
new: 751.0
path: .metrics.halstead.difficulty
old: 13.555555555555555
new: 41.26315789473684
path: .metrics.halstead.volume
old: 2023.475899733631
new: 5399.558243718893
path: .metrics.halstead.N1
old: 228.0
new: 457.0
path: .metrics.halstead.effort
old: 27429.339974166996
new: 222802.82437240065
path: .metrics.halstead.estimated_program_length
old: 280.35267028370896
new: 938.9494616147804
path: .metrics.halstead.n1
old: 10.0
new: 32.0
path: .metrics.halstead.n2
old: 45.0
new: 114.0
path: .metrics.halstead.purity_ratio
old: 0.8010076293820256
new: 1.2502655946934491
path: .metrics.halstead.time
old: 1523.852220787055
new: 12377.934687355591
path: .metrics.halstead.level
old: 0.07377049180327869
new: 0.02423469387755102
path: .metrics.halstead.bugs
old: 0.3031719265561997
new: 1.2250652094662555
path: .metrics.halstead.vocabulary
old: 55.0
new: 146.0
path: .metrics.halstead.N2
old: 122.0
new: 294.0
path: .metrics.cognitive.sum
old: 0.0
new: 38.0
path: .metrics.cognitive.average
old: 0.0
new: 2.111111111111111
path: .metrics.nexits.average
old: 0.0
new: 1.0555555555555556
path: .metrics.nexits.sum
old: 0.0
new: 19.0
path: .metrics.mi.mi_original
old: 60.529182372302145
new: 22.371772622026015
path: .metrics.mi.mi_sei
old: 47.01587212860881
new: -5.648552654715594
path: .metrics.mi.mi_visual_studio
old: 35.397182673860904
new: 13.082907966097084
path: .metrics.nom.total
old: 2.0
new: 18.0
path: .metrics.nom.functions
old: 2.0
new: 18.0
path: .metrics.loc.ploc
old: 44.0
new: 186.0
path: .metrics.loc.blank
old: 11.0
new: 54.0
path: .metrics.loc.lloc
old: 0.0
new: 99.0
path: .metrics.loc.cloc
old: 18.0
new: 65.0
path: .metrics.loc.sloc
old: 73.0
new: 305.0

# Spaces Data

## Minimal test - lines (23, 36)

path: .spaces[0].metrics.mi.mi_original
old: null
new: 99.2370838886526
path: .spaces[0].metrics.mi.mi_sei
old: null
new: 67.56981666583283
path: .spaces[0].metrics.mi.mi_visual_studio
old: null
new: 58.03338239102491
path: .spaces[0].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[0].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[0].metrics.halstead.length
old: 1.0
new: 56.0
path: .spaces[0].metrics.halstead.difficulty
old: 0.0
new: 3.75
path: .spaces[0].metrics.halstead.n2
old: 1.0
new: 18.0
path: .spaces[0].metrics.halstead.effort
old: 0.0
new: 949.9480107719728
path: .spaces[0].metrics.halstead.N2
old: 1.0
new: 27.0
path: .spaces[0].metrics.halstead.time
old: 0.0
new: 52.77488948733182
path: .spaces[0].metrics.halstead.vocabulary
old: 1.0
new: 23.0
path: .spaces[0].metrics.halstead.purity_ratio
old: null
new: 1.547648044649972
path: .spaces[0].metrics.halstead.N1
old: 0.0
new: 29.0
path: .spaces[0].metrics.halstead.bugs
old: 0.0
new: 0.032211575742660606
path: .spaces[0].metrics.halstead.estimated_program_length
old: null
new: 86.66829050039843
path: .spaces[0].metrics.halstead.volume
old: 0.0
new: 253.3194695391927
path: .spaces[0].metrics.halstead.level
old: null
new: 0.26666666666666666
path: .spaces[0].metrics.halstead.n1
old: 0.0
new: 5.0
path: .spaces[0].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[0].metrics.nargs.average
old: null
new: 0.0
path: .spaces[0].metrics.nexits.average
old: null
new: 0.0
path: .spaces[0].metrics.loc.sloc
old: 1.0
new: 14.0
path: .spaces[0].metrics.loc.ploc
old: 1.0
new: 14.0

### Code

    nsBaseAppShell::nsBaseAppShell()
        : mSuspendNativeCount(0),
          mEventloopNestingLevel(0),
          mBlockedWait(nullptr),
          mFavorPerf(0),
          mNativeEventPending(false),
          mStarvationDelay(0),
          mSwitchTime(0),
          mLastNativeEventTime(0),
          mEventloopNestingState(eEventloopNone),
          mRunning(false),
          mExiting(false),
          mBlockNativeEvent(false),
          mProcessedGeckoEvents(false) {}

## Minimal test - lines (40, 54)

path: .spaces[1].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[1].metrics.nexits.average
old: null
new: 1.0
path: .spaces[1].metrics.mi.mi_sei
old: null
new: 84.51177860737921
path: .spaces[1].metrics.mi.mi_visual_studio
old: null
new: 56.925727159747645
path: .spaces[1].metrics.mi.mi_original
old: null
new: 97.34299344316848
path: .spaces[1].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[1].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[1].metrics.cyclomatic.sum
old: 1.0
new: 3.0
path: .spaces[1].metrics.cyclomatic.average
old: 1.0
new: 3.0
path: .spaces[1].metrics.nargs.average
old: null
new: 0.0
path: .spaces[1].metrics.cognitive.average
old: null
new: 2.0
path: .spaces[1].metrics.cognitive.sum
old: 0.0
new: 2.0
path: .spaces[1].metrics.halstead.volume
old: 0.0
new: 269.2118756352258
path: .spaces[1].metrics.halstead.effort
old: 0.0
new: 1916.1551148154304
path: .spaces[1].metrics.halstead.N2
old: 1.0
new: 22.0
path: .spaces[1].metrics.halstead.bugs
old: 0.0
new: 0.05142399984734584
path: .spaces[1].metrics.halstead.estimated_program_length
old: null
new: 107.54061610626604
path: .spaces[1].metrics.halstead.time
old: 0.0
new: 106.4530619341906
path: .spaces[1].metrics.halstead.level
old: null
new: 0.14049586776859505
path: .spaces[1].metrics.halstead.n2
old: 1.0
new: 17.0
path: .spaces[1].metrics.halstead.n1
old: 0.0
new: 11.0
path: .spaces[1].metrics.halstead.N1
old: 0.0
new: 34.0
path: .spaces[1].metrics.halstead.length
old: 1.0
new: 56.0
path: .spaces[1].metrics.halstead.difficulty
old: 0.0
new: 7.117647058823529
path: .spaces[1].metrics.halstead.purity_ratio
old: null
new: 1.9203681447547507
path: .spaces[1].metrics.halstead.vocabulary
old: 1.0
new: 28.0
path: .spaces[1].metrics.loc.ploc
old: 1.0
new: 11.0
path: .spaces[1].metrics.loc.blank
old: 0.0
new: 3.0
path: .spaces[1].metrics.loc.sloc
old: 1.0
new: 15.0
path: .spaces[1].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[1].metrics.loc.lloc
old: 0.0
new: 6.0

### Code

    nsresult nsBaseAppShell::Init() {
      // Configure ourselves as an observer for the current thread:

      if (XRE_UseNativeEventProcessing()) {
        nsCOMPtr threadInt =
            do_QueryInterface(NS_GetCurrentThread());
        NS_ENSURE_STATE(threadInt);

        threadInt->SetObserver(this);
      }

      nsCOMPtr obsSvc = mozilla::services::GetObserverService();
      if (obsSvc) obsSvc->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
      return NS_OK;
    }

## Minimal test - lines (57, 97)

path: .spaces[2].metrics.mi.mi_sei
old: 51.16870116126591
new: 75.80782634277774
path: .spaces[2].metrics.mi.mi_visual_studio
old: 39.5318730200677
new: 45.22408014098128
path: .spaces[2].metrics.mi.mi_original
old: 67.59950286431577
new: 77.33317704107799
path: .spaces[2].metrics.cognitive.average
old: 0.0
new: 6.0
path: .spaces[2].metrics.cognitive.sum
old: 0.0
new: 6.0
path: .spaces[2].metrics.nexits.sum
old: 0.0
new: 3.0
path: .spaces[2].metrics.nexits.average
old: 0.0
new: 3.0
path: .spaces[2].metrics.nom.functions
old: 2.0
new: 1.0
path: .spaces[2].metrics.nom.total
old: 2.0
new: 1.0
path: .spaces[2].metrics.loc.cloc
old: 8.0
new: 14.0
path: .spaces[2].metrics.loc.lloc
old: 0.0
new: 17.0
path: .spaces[2].metrics.loc.ploc
old: 36.0
new: 21.0
path: .spaces[2].metrics.loc.sloc
old: 50.0
new: 41.0
path: .spaces[2].metrics.cyclomatic.average
old: 1.0
new: 6.0
path: .spaces[2].metrics.cyclomatic.sum
old: 3.0
new: 6.0
path: .spaces[2].metrics.halstead.estimated_program_length
old: 252.87891313821507
new: 146.21321194585474
path: .spaces[2].metrics.halstead.n2
old: 41.0
new: 22.0
path: .spaces[2].metrics.halstead.n1
old: 10.0
new: 13.0
path: .spaces[2].metrics.halstead.length
old: 340.0
new: 94.0
path: .spaces[2].metrics.halstead.effort
old: 27047.784252571393
new: 5128.350420032794
path: .spaces[2].metrics.halstead.vocabulary
old: 51.0
new: 35.0
path: .spaces[2].metrics.halstead.volume
old: 1928.6246162703085
new: 482.1526035928269
path: .spaces[2].metrics.halstead.time
old: 1502.6546806984106
new: 284.9083566684886
path: .spaces[2].metrics.halstead.purity_ratio
old: 0.7437615092300444
new: 1.5554597015516465
path: .spaces[2].metrics.halstead.level
old: 0.07130434782608697
new: 0.09401709401709402
path: .spaces[2].metrics.halstead.N2
old: 115.0
new: 36.0
path: .spaces[2].metrics.halstead.difficulty
old: 14.024390243902438
new: 10.636363636363637
path: .spaces[2].metrics.halstead.N1
old: 225.0
new: 58.0
path: .spaces[2].metrics.halstead.bugs
old: 0.3003538531036088
new: 0.09912819702913184

### Code

    void nsBaseAppShell::NativeEventCallback() {
      if (!mNativeEventPending.exchange(false)) return;

      // If DoProcessNextNativeEvent is on the stack, then we assume that we can
      // just unwind and let nsThread::ProcessNextEvent process the next event.
      // However, if we are called from a nested native event loop (maybe via some
      // plug-in or library function), then go ahead and process Gecko events now.
      if (mEventloopNestingState == eEventloopXPCOM) {
        mEventloopNestingState = eEventloopOther;
        // XXX there is a tiny risk we will never get a new NativeEventCallback,
        // XXX see discussion in bug 389931.
        return;
      }

      // nsBaseAppShell::Run is not being used to pump events, so this may be
      // our only opportunity to process pending gecko events.

      nsIThread* thread = NS_GetCurrentThread();
      bool prevBlockNativeEvent = mBlockNativeEvent;
      if (mEventloopNestingState == eEventloopOther) {
        if (!NS_HasPendingEvents(thread)) return;
        // We're in a nested native event loop and have some gecko events to
        // process.  While doing that we block processing native events from the
        // appshell - instead, we want to get back to the nested native event
        // loop ASAP (bug 420148).
        mBlockNativeEvent = true;
      }

      IncrementEventloopNestingLevel();
      EventloopNestingState prevVal = mEventloopNestingState;
      NS_ProcessPendingEvents(thread, THREAD_EVENT_STARVATION_LIMIT);
      mProcessedGeckoEvents = true;
      mEventloopNestingState = prevVal;
      mBlockNativeEvent = prevBlockNativeEvent;

      // Continue processing pending events later (we don't want to starve the
      // embedders event loop).
      if (NS_HasPendingEvents(thread)) DoProcessMoreGeckoEvents();

      DecrementEventloopNestingLevel();
    }