Global Metrics

path: .metrics.cyclomatic.average
old: 1.0
new: 1.2

path: .metrics.cyclomatic.sum
old: 2.0
new: 12.0

path: .metrics.nom.total
old: 1.0
new: 7.0

path: .metrics.nom.functions
old: 1.0
new: 7.0

path: .metrics.nargs.sum
old: 0.0
new: 3.0

path: .metrics.nargs.average
old: 0.0
new: 0.42857142857142855

path: .metrics.nexits.sum
old: 1.0
new: 2.0

path: .metrics.nexits.average
old: 1.0
new: 0.2857142857142857

path: .metrics.halstead.n2
old: 2.0
new: 91.0

path: .metrics.halstead.time
old: 2.7293728408893374
new: 1406.4435778190295

path: .metrics.halstead.length
old: 7.0
new: 305.0

path: .metrics.halstead.N1
old: 5.0
new: 181.0

path: .metrics.halstead.effort
old: 49.12871113600807
new: 25315.98440074253

path: .metrics.halstead.vocabulary
old: 7.0
new: 109.0

path: .metrics.halstead.volume
old: 19.651484454403228
new: 2064.2962190569624

path: .metrics.halstead.estimated_program_length
old: 13.60964047443681
new: 667.2679622840429

path: .metrics.halstead.N2
old: 2.0
new: 124.0

path: .metrics.halstead.difficulty
old: 2.5
new: 12.263736263736265

path: .metrics.halstead.level
old: 0.4
new: 0.08154121863799282

path: .metrics.halstead.purity_ratio
old: 1.944234353490973
new: 2.187763810767354

path: .metrics.halstead.n1
old: 5.0
new: 18.0

path: .metrics.halstead.bugs
old: 0.004471319041702271
new: 0.28739240818856404

path: .metrics.loc.sloc
old: 3.0
new: 133.0

path: .metrics.loc.cloc
old: 0.0
new: 17.0

path: .metrics.loc.blank
old: 0.0
new: 14.0

path: .metrics.loc.ploc
old: 3.0
new: 102.0

path: .metrics.loc.lloc
old: 1.0
new: 4.0

path: .metrics.mi.mi_sei
old: 122.52146225357944
new: 22.983900818519867

path: .metrics.mi.mi_visual_studio
old: 80.26671692775281
new: 28.846264344857097

path: .metrics.mi.mi_original
old: 137.2560859464573
new: 49.32711202970563

Spaces Data

Minimal test - lines (67, 132)

path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 1.2222222222222223

path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 11.0

path: .spaces[0].metrics.nom.total
old: 1.0
new: 7.0

path: .spaces[0].metrics.nom.functions
old: 1.0
new: 7.0

path: .spaces[0].metrics.mi.mi_original
old: 137.4860859464573
new: 64.10468695240657

path: .spaces[0].metrics.mi.mi_sei
old: 122.75146225357946
new: 43.582023346917765

path: .spaces[0].metrics.mi.mi_visual_studio
old: 80.40121985172942
new: 37.48812102479916

path: .spaces[0].metrics.nexits.average
old: 1.0
new: 0.2857142857142857

path: .spaces[0].metrics.nexits.sum
old: 1.0
new: 2.0

path: .spaces[0].metrics.nargs.average
old: 0.0
new: 0.42857142857142855

path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 3.0

path: .spaces[0].metrics.halstead.n2
old: 2.0
new: 42.0

path: .spaces[0].metrics.halstead.bugs
old: 0.004471319041702271
new: 0.2033832010864647

path: .spaces[0].metrics.halstead.n1
old: 5.0
new: 18.0

path: .spaces[0].metrics.halstead.estimated_program_length
old: 13.60964047443681
new: 301.5359817826695

path: .spaces[0].metrics.halstead.length
old: 7.0
new: 189.0

path: .spaces[0].metrics.halstead.volume
old: 19.651484454403228
new: 1116.40232257001

path: .spaces[0].metrics.halstead.effort
old: 49.12871113600807
new: 15071.431354695136

path: .spaces[0].metrics.halstead.N2
old: 2.0
new: 63.0

path: .spaces[0].metrics.halstead.N1
old: 5.0
new: 126.0

path: .spaces[0].metrics.halstead.time
old: 2.7293728408893374
new: 837.3017419275076

path: .spaces[0].metrics.halstead.purity_ratio
old: 1.944234353490973
new: 1.5954284750405794

path: .spaces[0].metrics.halstead.vocabulary
old: 7.0
new: 60.0

path: .spaces[0].metrics.halstead.difficulty
old: 2.5
new: 13.5

path: .spaces[0].metrics.halstead.level
old: 0.4
new: 0.07407407407407407

path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 8.0

path: .spaces[0].metrics.loc.lloc
old: 1.0
new: 4.0

path: .spaces[0].metrics.loc.sloc
old: 3.0
new: 66.0

path: .spaces[0].metrics.loc.ploc
old: 3.0
new: 47.0

path: .spaces[0].metrics.loc.blank
old: 0.0
new: 11.0

Code

class nsUXThemeData {
  // This class makes sure we don't attempt to open a theme if the previous
  // loading attempt has failed because OpenThemeData is a heavy task and
  // it's less likely that the API returns a different result.
  class ThemeHandle final {
    mozilla::Maybe mHandle;

   public:
    ThemeHandle() = default;
    ~ThemeHandle();

    // Disallow copy and move
    ThemeHandle(const ThemeHandle&) = delete;
    ThemeHandle(ThemeHandle&&) = delete;
    ThemeHandle& operator=(const ThemeHandle&) = delete;
    ThemeHandle& operator=(ThemeHandle&&) = delete;

    operator HANDLE();
    void OpenOnce(HWND aWindow, LPCWSTR aClassList);
    void Close();
  };

  static ThemeHandle sThemes[eUXNumClasses];

  // We initialize sCommandButtonBoxMetrics separately as a performance
  // optimization to avoid fetching dummy values for sCommandButtonMetrics
  // when we don't need those.
  static SIZE sCommandButtonMetrics[3];
  static bool sCommandButtonMetricsInitialized;
  static SIZE sCommandButtonBoxMetrics;
  static bool sCommandButtonBoxMetricsInitialized;

  static const wchar_t* GetClassName(nsUXThemeClass);
  static void EnsureCommandButtonMetrics();
  static void EnsureCommandButtonBoxMetrics();

 public:
  static bool sTitlebarInfoPopulatedAero;
  static bool sTitlebarInfoPopulatedThemed;
  static mozilla::LookAndFeel::WindowsTheme sThemeId;
  static bool sIsDefaultWindowsTheme;
  static bool sIsHighContrastOn;

  static void Invalidate();
  static HANDLE GetTheme(nsUXThemeClass cls);
  static HMODULE GetThemeDLL();

  // nsWindow calls this to update desktop settings info
  static void UpdateTitlebarInfo(HWND aWnd);

  static SIZE GetCommandButtonMetrics(CmdButtonIdx aMetric) {
    EnsureCommandButtonMetrics();
    return sCommandButtonMetrics[aMetric];
  }
  static SIZE GetCommandButtonBoxMetrics() {
    EnsureCommandButtonBoxMetrics();
    return sCommandButtonBoxMetrics;
  }
  static void UpdateNativeThemeInfo();
  static mozilla::LookAndFeel::WindowsTheme GetNativeThemeId();
  static bool IsDefaultWindowTheme();
  static bool IsHighContrastOn();

  static bool AreFlatMenusEnabled();
  static bool IsAppThemed();
};