Global Metrics

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

path: .metrics.cyclomatic.sum
old: 31.0
new: 6.0

path: .metrics.halstead.N2
old: 249.0
new: 143.0

path: .metrics.halstead.vocabulary
old: 138.0
new: 93.0

path: .metrics.halstead.level
old: 0.03815261044176707
new: 0.08606777837547068

path: .metrics.halstead.estimated_program_length
old: 888.9885616320882
new: 553.8599639268232

path: .metrics.halstead.volume
old: 4336.199918634683
new: 2033.6783902545976

path: .metrics.halstead.n1
old: 24.0
new: 13.0

path: .metrics.halstead.purity_ratio
old: 1.4573582977575217
new: 1.780900205552486

path: .metrics.halstead.N1
old: 361.0
new: 168.0

path: .metrics.halstead.time
old: 6314.1156709943625
new: 1312.711155376145

path: .metrics.halstead.length
old: 610.0
new: 311.0

path: .metrics.halstead.bugs
old: 0.7821116790287715
new: 0.2744773629700805

path: .metrics.halstead.effort
old: 113654.08207789852
new: 23628.800796770607

path: .metrics.halstead.n2
old: 114.0
new: 80.0

path: .metrics.halstead.difficulty
old: 26.210526315789473
new: 11.61875

path: .metrics.nexits.average
old: 1.0952380952380951
new: 0.0

path: .metrics.nexits.sum
old: 23.0
new: 0.0

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

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

path: .metrics.mi.mi_visual_studio
old: 20.958667691941464
new: 31.671313798267896

path: .metrics.mi.mi_original
old: 35.839321753219906
new: 54.1579465950381

path: .metrics.mi.mi_sei
old: -5.959781610931708
new: 20.89786254430325

path: .metrics.loc.sloc
old: 184.0
new: 108.0

path: .metrics.loc.blank
old: 39.0
new: 19.0

path: .metrics.loc.lloc
old: 55.0
new: 0.0

path: .metrics.loc.cloc
old: 7.0
new: 6.0

path: .metrics.loc.ploc
old: 138.0
new: 83.0

path: .metrics.cognitive.average
old: 0.3333333333333333
new: 0.0

path: .metrics.cognitive.sum
old: 7.0
new: 0.0

path: .metrics.nargs.sum
old: 32.0
new: 8.0

path: .metrics.nargs.average
old: 1.5238095238095235
new: 8.0

Spaces Data

Minimal test - lines (18, 106)

path: .spaces[0].metrics.mi.mi_original
old: 120.23754699949156
new: 57.71802216163934

path: .spaces[0].metrics.mi.mi_sei
old: 97.86708065221184
new: 16.251607584085797

path: .spaces[0].metrics.mi.mi_visual_studio
old: 70.3143549704629
new: 33.75322933429201

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

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

path: .spaces[0].metrics.nargs.average
old: 1.0
new: 8.0

path: .spaces[0].metrics.nargs.sum
old: 1.0
new: 8.0

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

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

path: .spaces[0].metrics.loc.lloc
old: 3.0
new: 0.0

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

path: .spaces[0].metrics.loc.ploc
old: 5.0
new: 72.0

path: .spaces[0].metrics.loc.sloc
old: 5.0
new: 89.0

path: .spaces[0].metrics.halstead.time
old: 29.97472750250249
new: 1299.8880355108136

path: .spaces[0].metrics.halstead.volume
old: 110.36149671375917
new: 1958.6548227380133

path: .spaces[0].metrics.halstead.N2
old: 11.0
new: 136.0

path: .spaces[0].metrics.halstead.N1
old: 16.0
new: 168.0

path: .spaces[0].metrics.halstead.purity_ratio
old: 1.945530556036326
new: 1.6697541624749228

path: .spaces[0].metrics.halstead.n2
old: 9.0
new: 74.0

path: .spaces[0].metrics.halstead.bugs
old: 0.022091773291324876
new: 0.2726869658563649

path: .spaces[0].metrics.halstead.difficulty
old: 4.888888888888889
new: 11.945945945945946

path: .spaces[0].metrics.halstead.estimated_program_length
old: 52.529325012980806
new: 507.6052653923765

path: .spaces[0].metrics.halstead.n1
old: 8.0
new: 13.0

path: .spaces[0].metrics.halstead.level
old: 0.20454545454545453
new: 0.08371040723981901

path: .spaces[0].metrics.halstead.vocabulary
old: 17.0
new: 87.0

path: .spaces[0].metrics.halstead.length
old: 27.0
new: 304.0

path: .spaces[0].metrics.halstead.effort
old: 539.5450950450448
new: 23397.984639194645

Code

namespace mozilla {
namespace widget {

class ToastNotification;

class ToastNotificationHandler final
    : public nsIAlertNotificationImageListener {
 public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSIALERTNOTIFICATIONIMAGELISTENER

  ToastNotificationHandler(ToastNotification* backend,
                           nsIObserver* aAlertListener, const nsAString& aName,
                           const nsAString& aCookie, const nsAString& aTitle,
                           const nsAString& aMsg, const nsAString& aHostPort,
                           bool aClickable)
      : mBackend(backend),
        mHasImage(false),
        mAlertListener(aAlertListener),
        mName(aName),
        mCookie(aCookie),
        mTitle(aTitle),
        mMsg(aMsg),
        mHostPort(aHostPort),
        mClickable(aClickable),
        mSentFinished(!aAlertListener) {}

  nsresult InitAlertAsync(nsIAlertNotification* aAlert);

  void OnWriteBitmapFinished(nsresult rv);

  void UnregisterHandler();

 protected:
  virtual ~ToastNotificationHandler();

  typedef ABI::Windows::Data::Xml::Dom::IXmlDocument IXmlDocument;
  typedef ABI::Windows::UI::Notifications::IToastNotifier IToastNotifier;
  typedef ABI::Windows::UI::Notifications::IToastNotification
      IToastNotification;
  typedef ABI::Windows::UI::Notifications::IToastDismissedEventArgs
      IToastDismissedEventArgs;
  typedef ABI::Windows::UI::Notifications::IToastFailedEventArgs
      IToastFailedEventArgs;
  typedef ABI::Windows::UI::Notifications::ToastTemplateType ToastTemplateType;

  Microsoft::WRL::ComPtr mNotification;
  Microsoft::WRL::ComPtr mNotifier;

  RefPtr mBackend;

  nsCOMPtr mImageRequest;
  nsCOMPtr mImageFile;
  nsString mImageUri;
  bool mHasImage;

  EventRegistrationToken mActivatedToken;
  EventRegistrationToken mDismissedToken;
  EventRegistrationToken mFailedToken;

  nsCOMPtr mAlertListener;
  nsString mName;
  nsString mCookie;
  nsString mTitle;
  nsString mMsg;
  nsString mHostPort;
  bool mClickable;
  bool mSentFinished;

  nsresult TryShowAlert();
  bool ShowAlert();
  nsresult AsyncSaveImage(imgIRequest* aRequest);
  nsresult OnWriteBitmapSuccess();
  void SendFinished();

  bool CreateWindowsNotificationFromXml(IXmlDocument* aToastXml);
  Microsoft::WRL::ComPtr InitializeXmlForTemplate(
      ToastTemplateType templateType);

  HRESULT OnActivate(IToastNotification* notification,
                     IInspectable* inspectable);
  HRESULT OnDismiss(IToastNotification* notification,
                    IToastDismissedEventArgs* aArgs);
  HRESULT OnFail(IToastNotification* notification,
                 IToastFailedEventArgs* aArgs);
};

}  // namespace widget
}  // namespace mozilla