Bug 317937 Get rid of some unnecessary CIDs and change some possibly unsafe nsCOMPtr usage into the equivalently unsafe static casts r=darin sr=jst

This commit is contained in:
neil%parkwaycc.co.uk 2005-12-02 12:02:44 +00:00
Родитель 2925a31739
Коммит 480f8e01d3
11 изменённых файлов: 24 добавлений и 56 удалений

Просмотреть файл

@ -45,7 +45,7 @@ interface nsIFrame;
interface nsObjectFrame;
interface nsIContent;
[scriptable, uuid(0e80f152-d676-4fba-8862-9dc4eb761442)]
[scriptable, uuid(09a39069-a138-40dd-91dd-79ce45742b52)]
interface nsIAccessibilityService : nsIAccessibleRetrieval
{
nsIAccessible createOuterDocAccessible(in nsIDOMNode aNode);
@ -61,17 +61,17 @@ interface nsIAccessibilityService : nsIAccessibleRetrieval
nsIAccessible createHTMLLIAccessible(in nsISupports aFrame, in nsISupports aBulletFrame, in AString aBulletText);
nsIAccessible createHTMLCheckboxAccessible(in nsISupports aFrame);
nsIAccessible createHTMLCheckboxAccessibleXBL(in nsIDOMNode aNode);
nsIAccessible createHTMLComboboxAccessible(in nsIDOMNode aNode, in nsISupports aPresShell);
nsIAccessible createHTMLComboboxAccessible(in nsIDOMNode aNode, in nsIWeakReference aPresShell);
nsIAccessible createHTMLGenericAccessible(in nsISupports aFrame);
nsIAccessible createHTMLGroupboxAccessible(in nsISupports aFrame);
nsIAccessible createHTMLHRAccessible(in nsISupports aFrame);
nsIAccessible createHTMLImageAccessible(in nsISupports aFrame);
nsIAccessible createHTMLLabelAccessible(in nsISupports aFrame);
nsIAccessible createHTMLListboxAccessible(in nsIDOMNode aNode, in nsISupports aPresShell);
nsIAccessible createHTMLListboxAccessible(in nsIDOMNode aNode, in nsIWeakReference aPresShell);
nsIAccessible createHTMLObjectFrameAccessible(in nsObjectFrame aFrame);
nsIAccessible createHTMLRadioButtonAccessible(in nsISupports aFrame);
nsIAccessible createHTMLRadioButtonAccessibleXBL(in nsIDOMNode aNode);
nsIAccessible createHTMLSelectOptionAccessible(in nsIDOMNode aNode, in nsIAccessible aAccParent, in nsISupports aPresShell);
nsIAccessible createHTMLSelectOptionAccessible(in nsIDOMNode aNode, in nsIAccessible aAccParent, in nsIWeakReference aPresShell);
nsIAccessible createHTMLTableAccessible(in nsISupports aFrame);
nsIAccessible createHTMLTableCellAccessible(in nsISupports aFrame);
nsIAccessible createHTMLTableCaptionAccessible(in nsIDOMNode aDOMNode);

Просмотреть файл

@ -598,15 +598,9 @@ nsAccessibilityService::CreateHTMLCheckboxAccessibleXBL(nsIDOMNode *aNode, nsIAc
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresShell, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aPresShell, nsIAccessible **_retval)
{
nsCOMPtr<nsIPresShell> presShell(do_QueryInterface(aPresShell));
NS_ASSERTION(presShell,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr<nsIWeakReference> weakShell =
do_GetWeakReference(presShell);
*_retval = new nsHTMLComboboxAccessible(aDOMNode, weakShell);
*_retval = new nsHTMLComboboxAccessible(aDOMNode, aPresShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
@ -683,15 +677,9 @@ nsAccessibilityService::CreateHTMLGroupboxAccessible(nsISupports *aFrame, nsIAcc
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLListboxAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLListboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aPresShell, nsIAccessible **_retval)
{
nsCOMPtr<nsPresContext> presContext(do_QueryInterface(aPresContext));
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr<nsIWeakReference> weakShell =
do_GetWeakReference(presContext->PresShell());
*_retval = new nsHTMLSelectListAccessible(aDOMNode, weakShell);
*_retval = new nsHTMLSelectListAccessible(aDOMNode, aPresShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
@ -797,16 +785,10 @@ nsAccessibilityService::CreateHTMLRadioButtonAccessibleXBL(nsIDOMNode *aNode, ns
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLSelectOptionAccessible(nsIDOMNode* aDOMNode,
nsIAccessible *aParent,
nsISupports* aPresContext,
nsIWeakReference* aPresShell,
nsIAccessible **_retval)
{
nsCOMPtr<nsPresContext> presContext(do_QueryInterface(aPresContext));
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr<nsIWeakReference> weakShell =
do_GetWeakReference(presContext->PresShell());
*_retval = new nsHTMLSelectOptionAccessible(aDOMNode, weakShell);
*_retval = new nsHTMLSelectOptionAccessible(aDOMNode, aPresShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;

Просмотреть файл

@ -84,8 +84,6 @@ enum nsRangeIterationDirection {
class nsDocumentEncoder : public nsIDocumentEncoder
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_ENCODER_IID)
nsDocumentEncoder();
virtual ~nsDocumentEncoder();
@ -160,8 +158,6 @@ protected:
PRPackedBool mIsCopying; // Set to PR_TRUE only while copying
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsDocumentEncoder, NS_IDOCUMENT_ENCODER_IID)
NS_IMPL_ADDREF(nsDocumentEncoder)
NS_IMPL_RELEASE(nsDocumentEncoder)

Просмотреть файл

@ -4497,7 +4497,7 @@ nsDocShell::SuspendRefreshURIs()
timer->Cancel();
nsCOMPtr<nsRefreshTimer> rt = do_QueryInterface(callback);
nsCOMPtr<nsITimerCallback> rt = do_QueryInterface(callback);
NS_ASSERTION(rt, "RefreshURIList timer callbacks should only be RefreshTimer objects");
mRefreshURIList->ReplaceElementAt(rt, i);
@ -4544,13 +4544,13 @@ nsDocShell::RefreshURIFromQueue()
while (n) {
nsCOMPtr<nsISupports> element;
mRefreshURIList->GetElementAt(--n, getter_AddRefs(element));
nsCOMPtr<nsRefreshTimer> refreshInfo(do_QueryInterface(element));
nsCOMPtr<nsITimerCallback> refreshInfo(do_QueryInterface(element));
if (refreshInfo) {
// This is the nsRefreshTimer object, waiting to be
// setup in a timer object and fired.
// Create the timer and trigger it.
PRUint32 delay = refreshInfo->GetDelay();
PRUint32 delay = NS_STATIC_CAST(nsRefreshTimer*, NS_STATIC_CAST(nsITimerCallback*, refreshInfo))->GetDelay();
nsCOMPtr<nsITimer> timer = do_CreateInstance("@mozilla.org/timer;1");
if (timer) {
// Replace the nsRefreshTimer element in the queue with

Просмотреть файл

@ -267,7 +267,7 @@ nsPresContext::~nsPresContext()
NS_IF_RELEASE(mLangGroup);
}
NS_IMPL_ISUPPORTS2(nsPresContext, nsPresContext, nsIObserver)
NS_IMPL_ISUPPORTS1(nsPresContext, nsIObserver)
#define MAKE_FONT_PREF_KEY(_pref, _s0, _s1) \
_pref.Assign(_s0); \

Просмотреть файл

@ -118,16 +118,7 @@ const PRUint8 kPresContext_DefaultFixedFont_ID = 0x01; // kGenericFont_moz_fi
// An interface for presentation contexts. Presentation contexts are
// objects that provide an outer context for a presentation shell.
// hack to make egcs / gcc 2.95.2 happy
class nsPresContext_base : public nsIObserver
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPRESCONTEXT_IID)
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsPresContext_base, NS_IPRESCONTEXT_IID)
class nsPresContext : public nsPresContext_base {
class nsPresContext : public nsIObserver {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER

Просмотреть файл

@ -397,7 +397,8 @@ NS_IMETHODIMP nsComboboxControlFrame::GetAccessible(nsIAccessible** aAccessible)
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
return accService->CreateHTMLComboboxAccessible(node, GetPresContext()->PresShell(), aAccessible);
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(GetPresContext()->PresShell()));
return accService->CreateHTMLComboboxAccessible(node, weakShell, aAccessible);
}
return NS_ERROR_FAILURE;

Просмотреть файл

@ -561,8 +561,8 @@ NS_IMETHODIMP nsListControlFrame::GetAccessible(nsIAccessible** aAccessible)
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
return accService->CreateHTMLListboxAccessible(node, GetPresContext(),
aAccessible);
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(GetPresContext()->PresShell()));
return accService->CreateHTMLListboxAccessible(node, weakShell, aAccessible);
}
return NS_ERROR_FAILURE;

Просмотреть файл

@ -374,7 +374,7 @@ public:
protected:
nsString mURLSpec;
nsCOMPtr<nsMediaList> mMedia;
nsRefPtr<nsMediaList> mMedia;
nsCOMPtr<nsICSSStyleSheet> mChildSheet;
};
@ -513,7 +513,8 @@ CSSImportRuleImpl::SetSheet(nsICSSStyleSheet* aSheet)
nsCOMPtr<nsIDOMMediaList> mediaList;
rv = sheet->GetMedia(getter_AddRefs(mediaList));
NS_ENSURE_SUCCESS(rv, rv);
mMedia = do_QueryInterface(mediaList);
mMedia = NS_STATIC_CAST(nsMediaList*,
NS_STATIC_CAST(nsIDOMMediaList*, mediaList.get()));
return NS_OK;
}
@ -604,7 +605,7 @@ CSSImportRuleImpl::GetMedia(nsIDOMMediaList * *aMedia)
return NS_OK;
}
return CallQueryInterface(mMedia, aMedia);
return CallQueryInterface(mMedia.get(), aMedia);
}
NS_IMETHODIMP

Просмотреть файл

@ -1017,7 +1017,7 @@ mozTXTToHTMLConv::~mozTXTToHTMLConv()
MOZ_TIMER_PRINT(mGlyphHitTimer);
}
NS_IMPL_ISUPPORTS1(mozTXTToHTMLConv, mozTXTToHTMLConv)
NS_IMPL_ISUPPORTS0(mozTXTToHTMLConv)
PRInt32
mozTXTToHTMLConv::CiteLevelTXT(const PRUnichar *line,

Просмотреть файл

@ -59,9 +59,6 @@ public:
virtual ~mozTXTToHTMLConv();
NS_DECL_ISUPPORTS
// XXX Is this really needed? This isn't an interface.
NS_DECLARE_STATIC_IID_ACCESSOR(MOZITXTTOHTMLCONV_IID)
NS_DECL_MOZITXTTOHTMLCONV
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSISTREAMLISTENER