# Global Metrics

path: .metrics.cognitive.average
old: null
new: 0.1111111111111111
path: .metrics.cognitive.sum
old: 0.0
new: 2.0
path: .metrics.nexits.sum
old: 0.0
new: 11.0
path: .metrics.nexits.average
old: null
new: 0.6111111111111112
path: .metrics.nargs.average
old: null
new: 0.7222222222222222
path: .metrics.nargs.sum
old: 0.0
new: 13.0
path: .metrics.loc.sloc
old: 53.0
new: 144.0
path: .metrics.loc.blank
old: 11.0
new: 22.0
path: .metrics.loc.lloc
old: 0.0
new: 36.0
path: .metrics.loc.ploc
old: 24.0
new: 104.0
path: .metrics.mi.mi_sei
old: 71.23578204028465
new: 16.826803864625596
path: .metrics.mi.mi_visual_studio
old: 43.56652141651129
new: 26.00257907369391
path: .metrics.mi.mi_original
old: 74.49875162223431
new: 44.46441021601659
path: .metrics.cyclomatic.sum
old: 2.0
new: 23.0
path: .metrics.cyclomatic.average
old: 1.0
new: 1.0952380952380951
path: .metrics.nom.functions
old: 0.0
new: 18.0
path: .metrics.nom.total
old: 0.0
new: 18.0
path: .metrics.halstead.volume
old: 446.07383864270474
new: 2523.9481458333794
path: .metrics.halstead.bugs
old: 0.06681626000711022
new: 0.49859753440746607
path: .metrics.halstead.N2
old: 41.0
new: 152.0
path: .metrics.halstead.difficulty
old: 6.362068965517241
new: 22.92063492063492
path: .metrics.halstead.length
old: 85.0
new: 397.0
path: .metrics.halstead.vocabulary
old: 38.0
new: 82.0
path: .metrics.halstead.effort
old: 2837.952525157897
new: 57850.494009260314
path: .metrics.halstead.estimated_program_length
old: 169.4107738716804
new: 457.2792579359229
path: .metrics.halstead.N1
old: 44.0
new: 245.0
path: .metrics.halstead.level
old: 0.15718157181571815
new: 0.04362880886426593
path: .metrics.halstead.time
old: 157.6640291754387
new: 3213.916333847795
path: .metrics.halstead.purity_ratio
old: 1.9930679279021224
new: 1.1518369217529545
path: .metrics.halstead.n2
old: 29.0
new: 63.0
path: .metrics.halstead.n1
old: 9.0
new: 19.0

# Spaces Data

## Minimal test - lines (14, 144)

path: .spaces[0].metrics.mi.mi_sei
old: 77.89797478918999
new: 18.01385113792014
path: .spaces[0].metrics.mi.mi_original
old: 81.88500029305912
new: 46.664623669327
path: .spaces[0].metrics.mi.mi_visual_studio
old: 47.8859650836603
new: 27.28925360779357
path: .spaces[0].metrics.loc.cloc
old: 9.0
new: 14.0
path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 36.0
path: .spaces[0].metrics.loc.sloc
old: 35.0
new: 131.0
path: .spaces[0].metrics.loc.blank
old: 8.0
new: 19.0
path: .spaces[0].metrics.loc.ploc
old: 18.0
new: 98.0
path: .spaces[0].metrics.nargs.average
old: null
new: 0.7222222222222222
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 13.0
path: .spaces[0].metrics.nexits.average
old: null
new: 0.6111111111111112
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 11.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 150.7407576846492
new: 422.1345899383102
path: .spaces[0].metrics.halstead.length
old: 80.0
new: 387.0
path: .spaces[0].metrics.halstead.difficulty
old: 6.403846153846154
new: 22.271186440677965
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.8842594710581149
new: 1.0907870541041609
path: .spaces[0].metrics.halstead.bugs
old: 0.06347515523129883
new: 0.4762974163257113
path: .spaces[0].metrics.halstead.n1
old: 9.0
new: 18.0
path: .spaces[0].metrics.halstead.N1
old: 43.0
new: 241.0
path: .spaces[0].metrics.halstead.volume
old: 410.3426413555973
new: 2425.2463912489266
path: .spaces[0].metrics.halstead.N2
old: 37.0
new: 146.0
path: .spaces[0].metrics.halstead.level
old: 0.1561561561561561
new: 0.04490106544901066
path: .spaces[0].metrics.halstead.effort
old: 2627.771145604114
new: 54013.11454408626
path: .spaces[0].metrics.halstead.time
old: 145.9872858668952
new: 3000.72858578257
path: .spaces[0].metrics.halstead.vocabulary
old: 35.0
new: 77.0
path: .spaces[0].metrics.halstead.n2
old: 26.0
new: 59.0
path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 21.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 1.05
path: .spaces[0].metrics.cognitive.average
old: null
new: 0.05555555555555555
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[0].metrics.nom.functions
old: 0.0
new: 18.0
path: .spaces[0].metrics.nom.total
old: 0.0
new: 18.0

### Code

    namespace mozilla {
    namespace widget {

    // Platforms with no OOP compositor process support use
    // InProcessCompositorWidget by default.
    #if !defined(MOZ_WIDGET_SUPPORTS_OOP_COMPOSITING)
    /* static */
    RefPtr CompositorWidget::CreateLocal(
        const CompositorWidgetInitData& aInitData,
        const layers::CompositorOptions& aOptions, nsIWidget* aWidget) {
      // We're getting crashes from storing a NULL mWidget, and this is the
      // only remaining explanation that doesn't involve memory corruption,
      // so placing a release assert here. For even more sanity-checking, we
      // do it after the static_cast.
      nsBaseWidget* widget = static_cast(aWidget);
      MOZ_RELEASE_ASSERT(widget);
    #  ifdef MOZ_WIDGET_ANDROID
      return new AndroidCompositorWidget(aOptions, widget);
    #  else
      return new InProcessCompositorWidget(aOptions, widget);
    #  endif
    }
    #endif

    InProcessCompositorWidget::InProcessCompositorWidget(
        const layers::CompositorOptions& aOptions, nsBaseWidget* aWidget)
        : CompositorWidget(aOptions),
          mWidget(aWidget),
          mCanary(CANARY_VALUE),
          mWidgetSanity(aWidget) {
      // The only method of construction that is used outside of unit tests is
      // ::CreateLocal, above. That method of construction asserts that mWidget
      // is not assigned a NULL value. And yet mWidget is NULL in some crash
      // reports that involve other class methods. Adding a release assert here
      // will give us the earliest possible notification that we're headed for
      // a crash.
      MOZ_RELEASE_ASSERT(mWidget);
    }

    bool InProcessCompositorWidget::PreRender(WidgetRenderingContext* aContext) {
      CheckWidgetSanity();
      return mWidget->PreRender(aContext);
    }

    void InProcessCompositorWidget::PostRender(WidgetRenderingContext* aContext) {
      CheckWidgetSanity();
      mWidget->PostRender(aContext);
    }

    RefPtr
    InProcessCompositorWidget::GetNativeLayerRoot() {
      CheckWidgetSanity();
      return mWidget->GetNativeLayerRoot();
    }

    already_AddRefed
    InProcessCompositorWidget::StartRemoteDrawing() {
      CheckWidgetSanity();
      return mWidget->StartRemoteDrawing();
    }

    already_AddRefed
    InProcessCompositorWidget::StartRemoteDrawingInRegion(
        const LayoutDeviceIntRegion& aInvalidRegion,
        layers::BufferMode* aBufferMode) {
      CheckWidgetSanity();
      return mWidget->StartRemoteDrawingInRegion(aInvalidRegion, aBufferMode);
    }

    void InProcessCompositorWidget::EndRemoteDrawing() {
      CheckWidgetSanity();
      mWidget->EndRemoteDrawing();
    }

    void InProcessCompositorWidget::EndRemoteDrawingInRegion(
        gfx::DrawTarget* aDrawTarget, const LayoutDeviceIntRegion& aInvalidRegion) {
      CheckWidgetSanity();
      mWidget->EndRemoteDrawingInRegion(aDrawTarget, aInvalidRegion);
    }

    void InProcessCompositorWidget::CleanupRemoteDrawing() {
      CheckWidgetSanity();
      mWidget->CleanupRemoteDrawing();
    }

    void InProcessCompositorWidget::CleanupWindowEffects() {
      CheckWidgetSanity();
      mWidget->CleanupWindowEffects();
    }

    bool InProcessCompositorWidget::InitCompositor(
        layers::Compositor* aCompositor) {
      CheckWidgetSanity();
      return mWidget->InitCompositor(aCompositor);
    }

    LayoutDeviceIntSize InProcessCompositorWidget::GetClientSize() {
      CheckWidgetSanity();
      return mWidget->GetClientSize();
    }

    uint32_t InProcessCompositorWidget::GetGLFrameBufferFormat() {
      CheckWidgetSanity();
      return mWidget->GetGLFrameBufferFormat();
    }

    uintptr_t InProcessCompositorWidget::GetWidgetKey() {
      CheckWidgetSanity();
      return reinterpret_cast(mWidget);
    }

    nsIWidget* InProcessCompositorWidget::RealWidget() { return mWidget; }

    void InProcessCompositorWidget::ObserveVsync(VsyncObserver* aObserver) {
      CheckWidgetSanity();
      if (RefPtr cvd =
              mWidget->GetCompositorVsyncDispatcher()) {
        cvd->SetCompositorVsyncObserver(aObserver);
      }
    }

    const char* InProcessCompositorWidget::CANARY_VALUE =
        reinterpret_cast(0x1a1a1a1a);

    void InProcessCompositorWidget::CheckWidgetSanity() {
      MOZ_RELEASE_ASSERT(mWidgetSanity == mWidget);
      MOZ_RELEASE_ASSERT(mCanary == CANARY_VALUE);
    }

    }  // namespace widget
    }  // namespace mozilla