From 8ccbeba0489143c88c9ccb290422df4ca9273ee1 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Thu, 3 Jul 2003 02:49:06 +0000 Subject: [PATCH] Random already_AddRefed stuff. Bug 211380, r+sr=jst --- dom/src/base/nsScreen.cpp | 22 +++++++++++----------- dom/src/base/nsScreen.h | 3 ++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/dom/src/base/nsScreen.cpp b/dom/src/base/nsScreen.cpp index 56ddaa1a4989..855ca4206c2c 100644 --- a/dom/src/base/nsScreen.cpp +++ b/dom/src/base/nsScreen.cpp @@ -83,7 +83,7 @@ NS_IMETHODIMP ScreenImpl::SetDocShell(nsIDocShell* aDocShell) NS_IMETHODIMP ScreenImpl::GetTop(PRInt32* aTop) { - nsCOMPtr context (getter_AddRefs(GetDeviceContext())); + nsCOMPtr context(GetDeviceContext()); if (context) { nsRect rect; @@ -106,7 +106,7 @@ ScreenImpl::GetTop(PRInt32* aTop) NS_IMETHODIMP ScreenImpl::GetLeft(PRInt32* aLeft) { - nsCOMPtr context (getter_AddRefs(GetDeviceContext())); + nsCOMPtr context(GetDeviceContext()); if (context) { nsRect rect; @@ -129,7 +129,7 @@ ScreenImpl::GetLeft(PRInt32* aLeft) NS_IMETHODIMP ScreenImpl::GetWidth(PRInt32* aWidth) { - nsCOMPtr context (getter_AddRefs(GetDeviceContext())); + nsCOMPtr context(GetDeviceContext()); if (context) { PRInt32 height; @@ -151,7 +151,7 @@ ScreenImpl::GetWidth(PRInt32* aWidth) NS_IMETHODIMP ScreenImpl::GetHeight(PRInt32* aHeight) { - nsCOMPtr context (getter_AddRefs(GetDeviceContext())); + nsCOMPtr context(GetDeviceContext()); if (context) { PRInt32 width; @@ -173,7 +173,7 @@ ScreenImpl::GetHeight(PRInt32* aHeight) NS_IMETHODIMP ScreenImpl::GetPixelDepth(PRInt32* aPixelDepth) { - nsCOMPtr context (getter_AddRefs(GetDeviceContext())); + nsCOMPtr context(GetDeviceContext()); if (context) { PRUint32 depth; @@ -192,7 +192,7 @@ ScreenImpl::GetPixelDepth(PRInt32* aPixelDepth) NS_IMETHODIMP ScreenImpl::GetColorDepth(PRInt32* aColorDepth) { - nsCOMPtr context (getter_AddRefs(GetDeviceContext())); + nsCOMPtr context(GetDeviceContext()); if (context) { PRUint32 depth; @@ -211,7 +211,7 @@ ScreenImpl::GetColorDepth(PRInt32* aColorDepth) NS_IMETHODIMP ScreenImpl::GetAvailWidth(PRInt32* aAvailWidth) { - nsCOMPtr context (getter_AddRefs(GetDeviceContext())); + nsCOMPtr context(GetDeviceContext()); if (context) { nsRect rect; @@ -233,7 +233,7 @@ ScreenImpl::GetAvailWidth(PRInt32* aAvailWidth) NS_IMETHODIMP ScreenImpl::GetAvailHeight(PRInt32* aAvailHeight) { - nsCOMPtr context (getter_AddRefs(GetDeviceContext())); + nsCOMPtr context(GetDeviceContext()); if (context) { nsRect rect; @@ -255,7 +255,7 @@ ScreenImpl::GetAvailHeight(PRInt32* aAvailHeight) NS_IMETHODIMP ScreenImpl::GetAvailLeft(PRInt32* aAvailLeft) { - nsCOMPtr context (getter_AddRefs(GetDeviceContext())); + nsCOMPtr context(GetDeviceContext()); if (context) { nsRect rect; @@ -277,7 +277,7 @@ ScreenImpl::GetAvailLeft(PRInt32* aAvailLeft) NS_IMETHODIMP ScreenImpl::GetAvailTop(PRInt32* aAvailTop) { - nsCOMPtr context (getter_AddRefs(GetDeviceContext())); + nsCOMPtr context(GetDeviceContext()); if (context) { nsRect rect; @@ -296,7 +296,7 @@ ScreenImpl::GetAvailTop(PRInt32* aAvailTop) return NS_ERROR_FAILURE; } -nsIDeviceContext* ScreenImpl::GetDeviceContext() +already_AddRefed ScreenImpl::GetDeviceContext() { if(!mDocShell) return nsnull; diff --git a/dom/src/base/nsScreen.h b/dom/src/base/nsScreen.h index 07f64c4680da..70c5765c659a 100644 --- a/dom/src/base/nsScreen.h +++ b/dom/src/base/nsScreen.h @@ -41,6 +41,7 @@ #include "nsIDOMScreen.h" #include "nsISupports.h" #include "nsIScriptContext.h" +#include "nsCOMPtr.h" class nsIDocShell; class nsIDeviceContext; @@ -69,7 +70,7 @@ public: protected: - nsIDeviceContext* GetDeviceContext(); + already_AddRefed GetDeviceContext(); nsIDocShell* mDocShell; // Weak Reference };