Bug 1037643 - Part 4 - Cycle collect HTMLImageElement/ResponsiveImageSelector r=mccr8

This commit is contained in:
John Schoenick 2014-10-13 13:36:01 -07:00
parent 59f37ef16f
commit 5aa9d89c40
4 changed files with 16 additions and 3 deletions

View File

@ -22,7 +22,10 @@ using namespace mozilla::dom;
namespace mozilla {
namespace dom {
NS_IMPL_ISUPPORTS0(ResponsiveImageSelector);
NS_IMPL_CYCLE_COLLECTION(ResponsiveImageSelector, mContent)
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(ResponsiveImageSelector, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(ResponsiveImageSelector, Release)
static bool
ParseInteger(const nsAString& aString, int32_t& aInt)

View File

@ -9,6 +9,7 @@
#include "nsISupports.h"
#include "nsIContent.h"
#include "nsString.h"
#include "nsCycleCollectionParticipant.h"
class nsMediaQuery;
class nsCSSValue;
@ -18,11 +19,13 @@ namespace dom {
class ResponsiveImageCandidate;
class ResponsiveImageSelector : public nsISupports
class ResponsiveImageSelector
{
friend class ResponsiveImageCandidate;
public:
NS_DECL_ISUPPORTS
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(ResponsiveImageSelector)
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(ResponsiveImageSelector)
explicit ResponsiveImageSelector(nsIContent* aContent);
// NOTE ABOUT CURRENT SELECTION

View File

@ -116,6 +116,9 @@ HTMLImageElement::~HTMLImageElement()
NS_IMPL_ADDREF_INHERITED(HTMLImageElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLImageElement, Element)
NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLImageElement,
nsGenericHTMLElement,
mResponsiveSelector)
// QueryInterface implementation for HTMLImageElement
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLImageElement)

View File

@ -12,6 +12,7 @@
#include "nsIDOMHTMLImageElement.h"
#include "imgRequestProxy.h"
#include "Units.h"
#include "nsCycleCollectionParticipant.h"
// Only needed for IsPictureEnabled()
#include "mozilla/dom/HTMLPictureElement.h"
@ -37,6 +38,9 @@ public:
const Optional<uint32_t>& aHeight,
ErrorResult& aError);
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLImageElement,
nsGenericHTMLElement)
// nsISupports
NS_DECL_ISUPPORTS_INHERITED