Bug 1322459 part 2 - Remove duplicate mRefCnt in JumpListShortCut. r?ehsan
MozReview-Commit-ID: CFt05fItCOu
--- a/widget/windows/JumpListItem.cpp
+++ b/widget/windows/JumpListItem.cpp
@@ -21,43 +21,51 @@
namespace mozilla {
namespace widget {
// ISUPPORTS Impl's
NS_IMPL_ISUPPORTS(JumpListItem,
nsIJumpListItem)
-NS_IMPL_ISUPPORTS_INHERITED(JumpListSeparator,
- JumpListItem,
- nsIJumpListSeparator)
+NS_INTERFACE_MAP_BEGIN(JumpListSeparator)
+ NS_INTERFACE_MAP_ENTRY(nsIJumpListSeparator)
+ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIJumpListItem, JumpListItemBase)
+ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, JumpListItemBase)
+NS_INTERFACE_MAP_END
+NS_IMPL_ADDREF(JumpListSeparator)
+NS_IMPL_RELEASE(JumpListSeparator)
-NS_IMPL_ISUPPORTS_INHERITED(JumpListLink,
- JumpListItem,
- nsIJumpListLink)
+NS_INTERFACE_MAP_BEGIN(JumpListLink)
+ NS_INTERFACE_MAP_ENTRY(nsIJumpListLink)
+ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIJumpListItem, JumpListItemBase)
+ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, JumpListItemBase)
+NS_INTERFACE_MAP_END
+NS_IMPL_ADDREF(JumpListLink)
+NS_IMPL_RELEASE(JumpListLink)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(JumpListShortcut)
NS_INTERFACE_MAP_ENTRY(nsIJumpListShortcut)
-NS_INTERFACE_MAP_END_INHERITING(JumpListItem)
-
+ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIJumpListItem, JumpListItemBase)
+ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIJumpListShortcut)
+NS_INTERFACE_MAP_END
+NS_IMPL_CYCLE_COLLECTING_ADDREF(JumpListShortcut)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(JumpListShortcut)
NS_IMPL_CYCLE_COLLECTION(JumpListShortcut, mHandlerApp)
-NS_IMPL_CYCLE_COLLECTING_ADDREF(JumpListShortcut)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(JumpListShortcut)
-
-NS_IMETHODIMP JumpListItem::GetType(int16_t *aType)
+NS_IMETHODIMP JumpListItemBase::GetType(int16_t *aType)
{
NS_ENSURE_ARG_POINTER(aType);
*aType = mItemType;
return NS_OK;
}
-NS_IMETHODIMP JumpListItem::Equals(nsIJumpListItem *aItem, bool *aResult)
+NS_IMETHODIMP JumpListItemBase::Equals(nsIJumpListItem *aItem, bool *aResult)
{
NS_ENSURE_ARG_POINTER(aItem);
*aResult = false;
int16_t theType = nsIJumpListItem::JUMPLIST_ITEM_EMPTY;
if (NS_FAILED(aItem->GetType(&theType)))
return NS_OK;
--- a/widget/windows/JumpListItem.h
+++ b/widget/windows/JumpListItem.h
@@ -21,92 +21,100 @@
#include "nsString.h"
#include "nsCycleCollectionParticipant.h"
class nsIThread;
namespace mozilla {
namespace widget {
-class JumpListItem : public nsIJumpListItem
+class JumpListItemBase : public nsIJumpListItem
{
public:
- JumpListItem() :
+ JumpListItemBase() :
mItemType(nsIJumpListItem::JUMPLIST_ITEM_EMPTY)
{}
- JumpListItem(int32_t type) :
+ JumpListItemBase(int32_t type) :
mItemType(type)
{}
- NS_DECL_ISUPPORTS
NS_DECL_NSIJUMPLISTITEM
static const char kJumpListCacheDir[];
protected:
- virtual ~JumpListItem()
+ virtual ~JumpListItemBase()
{}
short Type() { return mItemType; }
short mItemType;
};
-class JumpListSeparator : public JumpListItem, public nsIJumpListSeparator
+class JumpListItem : public JumpListItemBase
+{
+ ~JumpListItem() {}
+
+public:
+ using JumpListItemBase::JumpListItemBase;
+
+ NS_DECL_ISUPPORTS
+};
+
+class JumpListSeparator : public JumpListItemBase, public nsIJumpListSeparator
{
~JumpListSeparator() {}
public:
JumpListSeparator() :
- JumpListItem(nsIJumpListItem::JUMPLIST_ITEM_SEPARATOR)
+ JumpListItemBase(nsIJumpListItem::JUMPLIST_ITEM_SEPARATOR)
{}
- NS_DECL_ISUPPORTS_INHERITED
- NS_IMETHOD GetType(int16_t *aType) override { return JumpListItem::GetType(aType); }
- NS_IMETHOD Equals(nsIJumpListItem *item, bool *_retval) override { return JumpListItem::Equals(item, _retval); }
+ NS_DECL_ISUPPORTS
+ NS_FORWARD_NSIJUMPLISTITEM(JumpListItemBase::)
static nsresult GetSeparator(RefPtr<IShellLinkW>& aShellLink);
};
-class JumpListLink : public JumpListItem, public nsIJumpListLink
+class JumpListLink : public JumpListItemBase, public nsIJumpListLink
{
~JumpListLink() {}
public:
JumpListLink() :
- JumpListItem(nsIJumpListItem::JUMPLIST_ITEM_LINK)
+ JumpListItemBase(nsIJumpListItem::JUMPLIST_ITEM_LINK)
{}
- NS_DECL_ISUPPORTS_INHERITED
- NS_IMETHOD GetType(int16_t *aType) override { return JumpListItem::GetType(aType); }
+ NS_DECL_ISUPPORTS
+ NS_IMETHOD GetType(int16_t *aType) override { return JumpListItemBase::GetType(aType); }
NS_IMETHOD Equals(nsIJumpListItem *item, bool *_retval) override;
NS_DECL_NSIJUMPLISTLINK
static nsresult GetShellItem(nsCOMPtr<nsIJumpListItem>& item, RefPtr<IShellItem2>& aShellItem);
static nsresult GetJumpListLink(IShellItem *pItem, nsCOMPtr<nsIJumpListLink>& aLink);
protected:
nsString mUriTitle;
nsCOMPtr<nsIURI> mURI;
nsCOMPtr<nsICryptoHash> mCryptoHash;
};
-class JumpListShortcut : public JumpListItem, public nsIJumpListShortcut
+class JumpListShortcut : public JumpListItemBase, public nsIJumpListShortcut
{
~JumpListShortcut() {}
public:
JumpListShortcut() :
- JumpListItem(nsIJumpListItem::JUMPLIST_ITEM_SHORTCUT)
+ JumpListItemBase(nsIJumpListItem::JUMPLIST_ITEM_SHORTCUT)
{}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
- NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(JumpListShortcut, JumpListItem)
- NS_IMETHOD GetType(int16_t *aType) override { return JumpListItem::GetType(aType); }
+ NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(JumpListShortcut, JumpListItemBase)
+ NS_IMETHOD GetType(int16_t *aType) override { return JumpListItemBase::GetType(aType); }
NS_IMETHOD Equals(nsIJumpListItem *item, bool *_retval) override;
NS_DECL_NSIJUMPLISTSHORTCUT
static nsresult GetShellLink(nsCOMPtr<nsIJumpListItem>& item,
RefPtr<IShellLinkW>& aShellLink,
nsCOMPtr<nsIThread> &aIOThread);
static nsresult GetJumpListShortcut(IShellLinkW *pLink, nsCOMPtr<nsIJumpListShortcut>& aShortcut);
static nsresult GetOutputIconPath(nsCOMPtr<nsIURI> aFaviconPageURI,