зеркало из https://github.com/mozilla/gecko-dev.git
Release theme global in nsBox from layout module destructor instead of on a object count for objects whose destructors are not all called. (Adds nsBox to the leak stats, which will make leaks go up.) b=177807 r=bryner sr=roc
This commit is contained in:
Родитель
45e056f997
Коммит
7e549bb314
|
@ -143,6 +143,7 @@ Shutdown(nsIModule* self)
|
||||||
nsRepeatService::Shutdown();
|
nsRepeatService::Shutdown();
|
||||||
nsSprocketLayout::Shutdown();
|
nsSprocketLayout::Shutdown();
|
||||||
nsStackLayout::Shutdown();
|
nsStackLayout::Shutdown();
|
||||||
|
nsBox::Shutdown();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Release all of our atoms
|
// Release all of our atoms
|
||||||
|
|
|
@ -216,28 +216,37 @@ void Coelesced()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PRUint32 nsBox::gRefCnt = 0;
|
PRBool nsBox::gGotTheme = PR_FALSE;
|
||||||
nsITheme* nsBox::gTheme = nsnull;
|
nsITheme* nsBox::gTheme = nsnull;
|
||||||
|
|
||||||
|
MOZ_DECL_CTOR_COUNTER(nsBox)
|
||||||
|
|
||||||
nsBox::nsBox(nsIPresShell* aShell):mMouseThrough(unset),
|
nsBox::nsBox(nsIPresShell* aShell):mMouseThrough(unset),
|
||||||
mNextChild(nsnull),
|
mNextChild(nsnull),
|
||||||
mParentBox(nsnull)
|
mParentBox(nsnull)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
MOZ_COUNT_CTOR(nsBox);
|
||||||
//mX = 0;
|
//mX = 0;
|
||||||
//mY = 0;
|
//mY = 0;
|
||||||
gRefCnt++;
|
if (!gGotTheme) {
|
||||||
if (gRefCnt == 1)
|
gGotTheme = PR_TRUE;
|
||||||
nsServiceManager::GetService("@mozilla.org/chrome/chrome-native-theme;1",
|
CallGetService("@mozilla.org/chrome/chrome-native-theme;1", &gTheme);
|
||||||
NS_GET_IID(nsITheme),
|
}
|
||||||
(nsISupports**)&gTheme);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsBox::~nsBox()
|
nsBox::~nsBox()
|
||||||
{
|
{
|
||||||
gRefCnt--;
|
// NOTE: This currently doesn't get called for |nsBoxToBlockAdaptor|
|
||||||
if (gRefCnt == 0 && gTheme)
|
// objects, so don't rely on putting anything here.
|
||||||
nsServiceManager::ReleaseService("@mozilla.org/chrome/chrome-native-theme;1", gTheme);
|
MOZ_COUNT_DTOR(nsBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* static */ void
|
||||||
|
nsBox::Shutdown()
|
||||||
|
{
|
||||||
|
gGotTheme = PR_FALSE;
|
||||||
|
NS_IF_RELEASE(gTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -46,6 +46,8 @@ class nsBox : public nsIBox {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
static void Shutdown();
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
NS_IMETHOD GetChildBox(nsIBox** aBox);
|
NS_IMETHOD GetChildBox(nsIBox** aBox);
|
||||||
|
@ -154,7 +156,7 @@ protected:
|
||||||
virtual void GetBoxName(nsAutoString& aName);
|
virtual void GetBoxName(nsAutoString& aName);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static PRUint32 gRefCnt;
|
static PRBool gGotTheme;
|
||||||
static nsITheme* gTheme;
|
static nsITheme* gTheme;
|
||||||
|
|
||||||
enum eMouseThrough {
|
enum eMouseThrough {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче