# Global Metrics

path: .metrics.halstead.N2
old: 51.0
new: 84.0
path: .metrics.halstead.estimated_program_length
old: 125.54887502163469
new: 281.4351007880244
path: .metrics.halstead.difficulty
old: 6.375
new: 12.69767441860465
path: .metrics.halstead.vocabulary
old: 30.0
new: 56.0
path: .metrics.halstead.effort
old: 2815.3284792303875
new: 15264.159720948708
path: .metrics.halstead.volume
old: 441.6201536047667
new: 1202.122468865924
path: .metrics.halstead.level
old: 0.1568627450980392
new: 0.07875457875457875
path: .metrics.halstead.n1
old: 6.0
new: 13.0
path: .metrics.halstead.n2
old: 24.0
new: 43.0
path: .metrics.halstead.length
old: 90.0
new: 207.0
path: .metrics.halstead.purity_ratio
old: 1.394987500240385
new: 1.359589858879345
path: .metrics.halstead.N1
old: 39.0
new: 123.0
path: .metrics.halstead.bugs
old: 0.06646068211642485
new: 0.20511339031022563
path: .metrics.halstead.time
old: 156.40713773502154
new: 848.0088733860393
path: .metrics.loc.sloc
old: 143.0
new: 111.0
path: .metrics.loc.blank
old: 15.0
new: 20.0
path: .metrics.loc.cloc
old: 100.0
new: 37.0
path: .metrics.loc.ploc
old: 28.0
new: 54.0
path: .metrics.nom.functions
old: 0.0
new: 2.0
path: .metrics.nom.total
old: 0.0
new: 2.0
path: .metrics.nexits.average
old: null
new: 0.0
path: .metrics.mi.mi_original
old: 57.781576305399454
new: 56.21802195184101
path: .metrics.mi.mi_sei
old: 56.286682825135784
new: 45.10988102157327
path: .metrics.mi.mi_visual_studio
old: 33.7903955002336
new: 32.87603622914679
path: .metrics.nargs.average
old: null
new: 0.0
path: .metrics.cyclomatic.sum
old: 5.0
new: 7.0
path: .metrics.cognitive.average
old: null
new: 0.0

# Spaces Data

## Minimal test - lines (16, 109)

path: .spaces[0].metrics.nexits.average
old: null
new: 0.0
path: .spaces[0].metrics.mi.mi_visual_studio
old: null
new: 34.80784321503811
path: .spaces[0].metrics.mi.mi_original
old: null
new: 59.52141189771517
path: .spaces[0].metrics.mi.mi_sei
old: null
new: 49.6240997896565
path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 6.0
path: .spaces[0].metrics.nargs.average
old: null
new: 0.0
path: .spaces[0].metrics.halstead.level
old: null
new: 0.07287449392712551
path: .spaces[0].metrics.halstead.N1
old: 0.0
new: 123.0
path: .spaces[0].metrics.halstead.difficulty
old: 0.0
new: 13.72222222222222
path: .spaces[0].metrics.halstead.purity_ratio
old: null
new: 1.1770000823505398
path: .spaces[0].metrics.halstead.n1
old: 0.0
new: 13.0
path: .spaces[0].metrics.halstead.vocabulary
old: 1.0
new: 49.0
path: .spaces[0].metrics.halstead.N2
old: 1.0
new: 76.0
path: .spaces[0].metrics.halstead.bugs
old: 0.0
new: 0.2057225853425428
path: .spaces[0].metrics.halstead.effort
old: 0.0
new: 15332.212942655267
path: .spaces[0].metrics.halstead.estimated_program_length
old: null
new: 234.2230163877574
path: .spaces[0].metrics.halstead.n2
old: 1.0
new: 36.0
path: .spaces[0].metrics.halstead.length
old: 1.0
new: 199.0
path: .spaces[0].metrics.halstead.volume
old: 0.0
new: 1117.3272589789265
path: .spaces[0].metrics.halstead.time
old: 0.0
new: 851.7896079252927
path: .spaces[0].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[0].metrics.loc.sloc
old: 1.0
new: 94.0
path: .spaces[0].metrics.loc.blank
old: 0.0
new: 18.0
path: .spaces[0].metrics.loc.ploc
old: 1.0
new: 45.0
path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 31.0
path: .spaces[0].metrics.nom.functions
old: 0.0
new: 2.0
path: .spaces[0].metrics.nom.total
old: 0.0
new: 2.0

### Code

    namespace mozilla {

    class VsyncObserver {
      NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VsyncObserver)

     public:
      // The method called when a vsync occurs. Return true if some work was done.
      // In general, this vsync notification will occur on the hardware vsync
      // thread from VsyncSource. But it might also be called on PVsync ipc thread
      // if this notification is cross process. Thus all observer should check the
      // thread model before handling the real task.
      virtual bool NotifyVsync(const VsyncEvent& aVsync) = 0;

     protected:
      VsyncObserver() = default;
      virtual ~VsyncObserver() = default;
    };  // VsyncObserver

    // Used to dispatch vsync events in the parent process to compositors.
    //
    // When the compositor is in-process, CompositorWidgets own a
    // CompositorVsyncDispatcher, and directly attach the compositor's observer
    // to it.
    //
    // When the compositor is out-of-process, the CompositorWidgetDelegate owns
    // the vsync dispatcher instead. The widget receives vsync observer/unobserve
    // commands via IPDL, and uses this to attach a CompositorWidgetVsyncObserver.
    // This observer forwards vsync notifications (on the vsync thread) to a
    // dedicated vsync I/O thread, which then forwards the notification to the
    // compositor thread in the compositor process.
    class CompositorVsyncDispatcher final {
      NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositorVsyncDispatcher)

     public:
      CompositorVsyncDispatcher();
      explicit CompositorVsyncDispatcher(RefPtr aVsyncSource);

      // Called on the vsync thread when a hardware vsync occurs
      void NotifyVsync(const VsyncEvent& aVsync);

      void MoveToSource(const RefPtr& aVsyncSource);

      // Compositor vsync observers must be added/removed on the compositor thread
      void SetCompositorVsyncObserver(VsyncObserver* aVsyncObserver);
      void Shutdown();

     private:
      virtual ~CompositorVsyncDispatcher();
      void ObserveVsync(bool aEnable);

      RefPtr mVsyncSource;
      Mutex mCompositorObserverLock;
      RefPtr mCompositorVsyncObserver;
      bool mDidShutdown;
    };

    // Dispatch vsync event to ipc actor parent and chrome RefreshTimer.
    class RefreshTimerVsyncDispatcher final {
      NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RefreshTimerVsyncDispatcher)

     public:
      explicit RefreshTimerVsyncDispatcher(gfx::VsyncSource::Display* aDisplay);

      // Please check CompositorVsyncDispatcher::NotifyVsync().
      void NotifyVsync(const VsyncEvent& aVsync);

      void MoveToDisplay(gfx::VsyncSource::Display* aDisplay);

      // Set chrome process's RefreshTimer to this dispatcher.
      // This function can be called from any thread.
      void SetParentRefreshTimer(VsyncObserver* aVsyncObserver);

      // Add or remove the content process' RefreshTimer to this dispatcher. This
      // will be a no-op for AddChildRefreshTimer() if the observer is already
      // registered.
      // These functions can be called from any thread.
      void AddChildRefreshTimer(VsyncObserver* aVsyncObserver);
      void RemoveChildRefreshTimer(VsyncObserver* aVsyncObserver);

     private:
      virtual ~RefreshTimerVsyncDispatcher();
      void UpdateVsyncStatus();
      bool NeedsVsync();

      // We need to hold a weak ref to the display we belong to in order to notify
      // it of our vsync requirement. The display holds a RefPtr to us, so we can't
      // hold a RefPtr back without causing a cyclic dependency.
      gfx::VsyncSource::Display* mDisplay;
      Mutex mRefreshTimersLock;
      RefPtr mParentRefreshTimer;
      nsTArray> mChildRefreshTimers;
    };

    }  // namespace mozilla