# Global Metrics

path: .metrics.mi.mi_visual_studio
old: 4.530164422824171
new: 30.705851351138655
path: .metrics.mi.mi_sei
old: -26.791468114926268
new: 30.507903833068507
path: .metrics.mi.mi_original
old: 7.746581163029333
new: 52.5070058104471
path: .metrics.cyclomatic.average
old: 1.0357142857142858
new: 1.1111111111111112
path: .metrics.cyclomatic.sum
old: 29.0
new: 10.0
path: .metrics.loc.blank
old: 107.0
new: 23.0
path: .metrics.loc.cloc
old: 162.0
new: 18.0
path: .metrics.loc.ploc
old: 388.0
new: 68.0
path: .metrics.loc.sloc
old: 657.0
new: 109.0
path: .metrics.loc.lloc
old: 208.0
new: 3.0
path: .metrics.halstead.purity_ratio
old: 0.5082696556309584
new: 1.4122852110124742
path: .metrics.halstead.bugs
old: 4.113129901827948
new: 0.3720099307156042
path: .metrics.halstead.difficulty
old: 68.73529411764706
new: 16.392857142857142
path: .metrics.halstead.effort
old: 1370694.028183296
new: 37283.24306435292
path: .metrics.halstead.time
old: 76149.66823240533
new: 2071.29128135294
path: .metrics.halstead.volume
old: 19941.63327267097
new: 2274.359054034601
path: .metrics.halstead.n1
old: 19.0
new: 17.0
path: .metrics.halstead.N2
old: 1230.0
new: 135.0
path: .metrics.halstead.estimated_program_length
old: 1340.3070818988374
new: 498.5366794874034
path: .metrics.halstead.length
old: 2637.0
new: 353.0
path: .metrics.halstead.level
old: 0.01454856653829696
new: 0.06100217864923747
path: .metrics.halstead.vocabulary
old: 189.0
new: 87.0
path: .metrics.halstead.n2
old: 170.0
new: 70.0
path: .metrics.halstead.N1
old: 1407.0
new: 218.0
path: .metrics.nexits.sum
old: 0.0
new: 1.0
path: .metrics.nexits.average
old: 0.0
new: 0.25
path: .metrics.nargs.average
old: 1.4
new: 1.25
path: .metrics.nargs.sum
old: 35.0
new: 5.0
path: .metrics.nom.total
old: 25.0
new: 4.0
path: .metrics.nom.functions
old: 25.0
new: 4.0

# Spaces Data

## Minimal test - lines (17, 107)

path: .spaces[1].metrics.mi.mi_original
old: 129.16123554141697
new: 56.07949935458514
path: .spaces[1].metrics.mi.mi_sei
old: 110.84306171748976
new: 31.66685140316248
path: .spaces[1].metrics.mi.mi_visual_studio
old: 75.5328862815304
new: 32.79502886233049
path: .spaces[1].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[1].metrics.nexits.average
old: 0.0
new: 0.25
path: .spaces[1].metrics.nom.total
old: 1.0
new: 4.0
path: .spaces[1].metrics.nom.functions
old: 1.0
new: 4.0
path: .spaces[1].metrics.nargs.average
old: 0.0
new: 1.25
path: .spaces[1].metrics.nargs.sum
old: 0.0
new: 5.0
path: .spaces[1].metrics.loc.ploc
old: 4.0
new: 60.0
path: .spaces[1].metrics.loc.lloc
old: 1.0
new: 3.0
path: .spaces[1].metrics.loc.cloc
old: 0.0
new: 11.0
path: .spaces[1].metrics.loc.blank
old: 0.0
new: 20.0
path: .spaces[1].metrics.loc.sloc
old: 4.0
new: 91.0
path: .spaces[1].metrics.cyclomatic.average
old: 1.0
new: 1.1428571428571428
path: .spaces[1].metrics.cyclomatic.sum
old: 2.0
new: 8.0
path: .spaces[1].metrics.halstead.volume
old: 38.039100017307746
new: 2193.355441593239
path: .spaces[1].metrics.halstead.level
old: 0.32
new: 0.059742647058823525
path: .spaces[1].metrics.halstead.estimated_program_length
old: 19.60964047443681
new: 460.9407761481053
path: .spaces[1].metrics.halstead.n1
old: 5.0
new: 17.0
path: .spaces[1].metrics.halstead.vocabulary
old: 9.0
new: 82.0
path: .spaces[1].metrics.halstead.length
old: 12.0
new: 345.0
path: .spaces[1].metrics.halstead.N2
old: 5.0
new: 128.0
path: .spaces[1].metrics.halstead.time
old: 6.604010419671484
new: 2039.633094404653
path: .spaces[1].metrics.halstead.n2
old: 4.0
new: 65.0
path: .spaces[1].metrics.halstead.N1
old: 7.0
new: 217.0
path: .spaces[1].metrics.halstead.effort
old: 118.87218755408672
new: 36713.39569928376
path: .spaces[1].metrics.halstead.bugs
old: 0.008058711007931684
new: 0.3682096068741957
path: .spaces[1].metrics.halstead.difficulty
old: 3.125
new: 16.73846153846154
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.6341367062030674
new: 1.3360602207191457

### Code

    namespace mozilla {
    namespace widget {

    class GeckoViewSupport final
        : public java::GeckoSession::Window::Natives {
      RefPtr mWindow;

      // We hold a WeakRef because we want to allow the
      // GeckoSession.Window to be garbage collected.
      // Callers need to create a LocalRef from this
      // before calling methods.
      java::GeckoSession::Window::WeakRef mGeckoViewWindow;

     public:
      typedef java::GeckoSession::Window::Natives Base;

      template
      static void OnNativeCall(Functor&& aCall) {
        NS_DispatchToMainThread(new WindowEvent(std::move(aCall)));
      }

      GeckoViewSupport(nsWindow* aWindow,
                       const java::GeckoSession::Window::LocalRef& aInstance,
                       nsPIDOMWindowOuter* aDOMWindow)
          : mWindow(aWindow), mGeckoViewWindow(aInstance), mDOMWindow(aDOMWindow) {}

      ~GeckoViewSupport();

      nsWindow* GetNsWindow() const { return mWindow; }

      using Base::DisposeNative;

      /**
       * GeckoView methods
       */
     private:
      nsCOMPtr mDOMWindow;
      bool mIsReady{false};

     public:
      // Create and attach a window.
      static void Open(const jni::Class::LocalRef& aCls,
                       java::GeckoSession::Window::Param aWindow,
                       jni::Object::Param aQueue, jni::Object::Param aCompositor,
                       jni::Object::Param aDispatcher,
                       jni::Object::Param aSessionAccessibility,
                       jni::Object::Param aInitData, jni::String::Param aId,
                       jni::String::Param aChromeURI, int32_t aScreenId,
                       bool aPrivateMode);

      // Close and destroy the nsWindow.
      void Close();

      // Transfer this nsWindow to new GeckoSession objects.
      void Transfer(const java::GeckoSession::Window::LocalRef& inst,
                    jni::Object::Param aQueue, jni::Object::Param aCompositor,
                    jni::Object::Param aDispatcher,
                    jni::Object::Param aSessionAccessibility,
                    jni::Object::Param aInitData);

      void AttachEditable(const java::GeckoSession::Window::LocalRef& inst,
                          jni::Object::Param aEditableParent);

      void AttachAccessibility(const java::GeckoSession::Window::LocalRef& inst,
                               jni::Object::Param aSessionAccessibility);

      void OnReady(jni::Object::Param aQueue = nullptr);

      auto OnLoadRequest(mozilla::jni::String::Param aUri, int32_t aWindowType,
                         int32_t aFlags, mozilla::jni::String::Param aTriggeringUri,
                         bool aHasUserGesture, bool aIsTopLevel) const
          -> java::GeckoResult::LocalRef;

      void PassExternalResponse(java::WebResponse::Param aResponse);

      void AttachMediaSessionController(
          const java::GeckoSession::Window::LocalRef& inst,
          jni::Object::Param aController, const int64_t aId);

      void DetachMediaSessionController(
          const java::GeckoSession::Window::LocalRef& inst,
          jni::Object::Param aController);

      void OnWeakNonIntrusiveDetach(already_AddRefed aDisposer) {
        RefPtr disposer(aDisposer);
        disposer->Run();
      }
    };

    }  // namespace widget
    }  // namespace mozilla

## Minimal test - lines (15, 15)

path: .spaces[0].metrics.nexits.average
old: 0.0
new: null
path: .spaces[0].metrics.halstead.N2
old: 459.0
new: 1.0
path: .spaces[0].metrics.halstead.length
old: 985.0
new: 1.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 0.645273841791676
new: null
path: .spaces[0].metrics.halstead.N1
old: 526.0
new: 0.0
path: .spaces[0].metrics.halstead.n2
old: 87.0
new: 1.0
path: .spaces[0].metrics.halstead.time
old: 17446.040874825398
new: 0.0
path: .spaces[0].metrics.halstead.level
old: 0.021060275962236745
new: null
path: .spaces[0].metrics.halstead.bugs
old: 1.5400151944406462
new: 0.0
path: .spaces[0].metrics.halstead.n1
old: 18.0
new: 0.0
path: .spaces[0].metrics.halstead.vocabulary
old: 105.0
new: 1.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 635.5947341648009
new: null
path: .spaces[0].metrics.halstead.volume
old: 6613.53183490113
new: 0.0
path: .spaces[0].metrics.halstead.difficulty
old: 47.48275862068966
new: 0.0
path: .spaces[0].metrics.halstead.effort
old: 314028.7357468571
new: 0.0
path: .spaces[0].metrics.cognitive.average
old: 0.0
new: null
path: .spaces[0].metrics.nargs.average
old: 0.14285714285714285
new: null
path: .spaces[0].metrics.nargs.sum
old: 1.0
new: 0.0
path: .spaces[0].metrics.cyclomatic.sum
old: 9.0
new: 1.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.125
new: 1.0
path: .spaces[0].metrics.loc.sloc
old: 176.0
new: 1.0
path: .spaces[0].metrics.loc.lloc
old: 57.0
new: 0.0
path: .spaces[0].metrics.loc.cloc
old: 24.0
new: 0.0
path: .spaces[0].metrics.loc.ploc
old: 141.0
new: 1.0
path: .spaces[0].metrics.loc.blank
old: 11.0
new: 0.0
path: .spaces[0].metrics.mi.mi_sei
old: 9.161939564433036
new: null
path: .spaces[0].metrics.mi.mi_original
old: 39.42441912357461
new: null
path: .spaces[0].metrics.mi.mi_visual_studio
old: 23.055215861739537
new: null
path: .spaces[0].metrics.nom.functions
old: 7.0
new: 0.0
path: .spaces[0].metrics.nom.total
old: 7.0
new: 0.0

### Code

    class nsWindow;

## Minimal test - lines (18, 106)

path: .spaces[1].spaces[0].metrics.cyclomatic.average
old: 1.0
new: 1.1666666666666667
path: .spaces[1].spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 7.0
path: .spaces[1].spaces[0].metrics.nargs.average
old: 0.0
new: 1.25
path: .spaces[1].spaces[0].metrics.nargs.sum
old: 0.0
new: 5.0
path: .spaces[1].spaces[0].metrics.nom.functions
old: 1.0
new: 4.0
path: .spaces[1].spaces[0].metrics.nom.total
old: 1.0
new: 4.0
path: .spaces[1].spaces[0].metrics.halstead.time
old: 2.1834982727114696
new: 2037.7141933967755
path: .spaces[1].spaces[0].metrics.halstead.effort
old: 39.302968908806456
new: 36678.85548114196
path: .spaces[1].spaces[0].metrics.halstead.length
old: 7.0
new: 343.0
path: .spaces[1].spaces[0].metrics.halstead.vocabulary
old: 7.0
new: 81.0
path: .spaces[1].spaces[0].metrics.halstead.difficulty
old: 2.0
new: 16.8671875
path: .spaces[1].spaces[0].metrics.halstead.volume
old: 19.651484454403228
new: 2174.568550989426
path: .spaces[1].spaces[0].metrics.halstead.purity_ratio
old: 1.8221267860233523
new: 1.3221191495663434
path: .spaces[1].spaces[0].metrics.halstead.n1
old: 4.0
new: 17.0
path: .spaces[1].spaces[0].metrics.halstead.N1
old: 4.0
new: 216.0
path: .spaces[1].spaces[0].metrics.halstead.N2
old: 3.0
new: 127.0
path: .spaces[1].spaces[0].metrics.halstead.level
old: 0.5
new: 0.059286706808707734
path: .spaces[1].spaces[0].metrics.halstead.estimated_program_length
old: 12.754887502163468
new: 453.48686830125575
path: .spaces[1].spaces[0].metrics.halstead.n2
old: 3.0
new: 64.0
path: .spaces[1].spaces[0].metrics.halstead.bugs
old: 0.0038532659414573967
new: 0.36797862787341024
path: .spaces[1].spaces[0].metrics.nexits.average
old: 0.0
new: 0.25
path: .spaces[1].spaces[0].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[1].spaces[0].metrics.mi.mi_original
old: 155.2836050228807
new: 56.71424591662151
path: .spaces[1].spaces[0].metrics.mi.mi_sei
old: 148.4278547652622
new: 31.64647556520427
path: .spaces[1].spaces[0].metrics.mi.mi_visual_studio
old: 90.80912574437468
new: 33.1662256822348
path: .spaces[1].spaces[0].metrics.loc.lloc
old: 1.0
new: 3.0
path: .spaces[1].spaces[0].metrics.loc.sloc
old: 1.0
new: 89.0
path: .spaces[1].spaces[0].metrics.loc.blank
old: 0.0
new: 21.0
path: .spaces[1].spaces[0].metrics.loc.cloc
old: 0.0
new: 10.0
path: .spaces[1].spaces[0].metrics.loc.ploc
old: 1.0
new: 58.0

### Code

    namespace widget {

    class GeckoViewSupport final
        : public java::GeckoSession::Window::Natives {
      RefPtr mWindow;

      // We hold a WeakRef because we want to allow the
      // GeckoSession.Window to be garbage collected.
      // Callers need to create a LocalRef from this
      // before calling methods.
      java::GeckoSession::Window::WeakRef mGeckoViewWindow;

     public:
      typedef java::GeckoSession::Window::Natives Base;

      template
      static void OnNativeCall(Functor&& aCall) {
        NS_DispatchToMainThread(new WindowEvent(std::move(aCall)));
      }

      GeckoViewSupport(nsWindow* aWindow,
                       const java::GeckoSession::Window::LocalRef& aInstance,
                       nsPIDOMWindowOuter* aDOMWindow)
          : mWindow(aWindow), mGeckoViewWindow(aInstance), mDOMWindow(aDOMWindow) {}

      ~GeckoViewSupport();

      nsWindow* GetNsWindow() const { return mWindow; }

      using Base::DisposeNative;

      /**
       * GeckoView methods
       */
     private:
      nsCOMPtr mDOMWindow;
      bool mIsReady{false};

     public:
      // Create and attach a window.
      static void Open(const jni::Class::LocalRef& aCls,
                       java::GeckoSession::Window::Param aWindow,
                       jni::Object::Param aQueue, jni::Object::Param aCompositor,
                       jni::Object::Param aDispatcher,
                       jni::Object::Param aSessionAccessibility,
                       jni::Object::Param aInitData, jni::String::Param aId,
                       jni::String::Param aChromeURI, int32_t aScreenId,
                       bool aPrivateMode);

      // Close and destroy the nsWindow.
      void Close();

      // Transfer this nsWindow to new GeckoSession objects.
      void Transfer(const java::GeckoSession::Window::LocalRef& inst,
                    jni::Object::Param aQueue, jni::Object::Param aCompositor,
                    jni::Object::Param aDispatcher,
                    jni::Object::Param aSessionAccessibility,
                    jni::Object::Param aInitData);

      void AttachEditable(const java::GeckoSession::Window::LocalRef& inst,
                          jni::Object::Param aEditableParent);

      void AttachAccessibility(const java::GeckoSession::Window::LocalRef& inst,
                               jni::Object::Param aSessionAccessibility);

      void OnReady(jni::Object::Param aQueue = nullptr);

      auto OnLoadRequest(mozilla::jni::String::Param aUri, int32_t aWindowType,
                         int32_t aFlags, mozilla::jni::String::Param aTriggeringUri,
                         bool aHasUserGesture, bool aIsTopLevel) const
          -> java::GeckoResult::LocalRef;

      void PassExternalResponse(java::WebResponse::Param aResponse);

      void AttachMediaSessionController(
          const java::GeckoSession::Window::LocalRef& inst,
          jni::Object::Param aController, const int64_t aId);

      void DetachMediaSessionController(
          const java::GeckoSession::Window::LocalRef& inst,
          jni::Object::Param aController);

      void OnWeakNonIntrusiveDetach(already_AddRefed aDisposer) {
        RefPtr disposer(aDisposer);
        disposer->Run();
      }
    };

    }  // namespace widget