зеркало из 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();
|
||||
nsSprocketLayout::Shutdown();
|
||||
nsStackLayout::Shutdown();
|
||||
nsBox::Shutdown();
|
||||
#endif
|
||||
|
||||
// Release all of our atoms
|
||||
|
|
|
@ -216,28 +216,37 @@ void Coelesced()
|
|||
|
||||
#endif
|
||||
|
||||
PRUint32 nsBox::gRefCnt = 0;
|
||||
PRBool nsBox::gGotTheme = PR_FALSE;
|
||||
nsITheme* nsBox::gTheme = nsnull;
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(nsBox)
|
||||
|
||||
nsBox::nsBox(nsIPresShell* aShell):mMouseThrough(unset),
|
||||
mNextChild(nsnull),
|
||||
mParentBox(nsnull)
|
||||
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsBox);
|
||||
//mX = 0;
|
||||
//mY = 0;
|
||||
gRefCnt++;
|
||||
if (gRefCnt == 1)
|
||||
nsServiceManager::GetService("@mozilla.org/chrome/chrome-native-theme;1",
|
||||
NS_GET_IID(nsITheme),
|
||||
(nsISupports**)&gTheme);
|
||||
if (!gGotTheme) {
|
||||
gGotTheme = PR_TRUE;
|
||||
CallGetService("@mozilla.org/chrome/chrome-native-theme;1", &gTheme);
|
||||
}
|
||||
}
|
||||
|
||||
nsBox::~nsBox()
|
||||
{
|
||||
gRefCnt--;
|
||||
if (gRefCnt == 0 && gTheme)
|
||||
nsServiceManager::ReleaseService("@mozilla.org/chrome/chrome-native-theme;1", gTheme);
|
||||
// NOTE: This currently doesn't get called for |nsBoxToBlockAdaptor|
|
||||
// objects, so don't rely on putting anything here.
|
||||
MOZ_COUNT_DTOR(nsBox);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsBox::Shutdown()
|
||||
{
|
||||
gGotTheme = PR_FALSE;
|
||||
NS_IF_RELEASE(gTheme);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -46,6 +46,8 @@ class nsBox : public nsIBox {
|
|||
|
||||
public:
|
||||
|
||||
static void Shutdown();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_IMETHOD GetChildBox(nsIBox** aBox);
|
||||
|
@ -154,7 +156,7 @@ protected:
|
|||
virtual void GetBoxName(nsAutoString& aName);
|
||||
#endif
|
||||
|
||||
static PRUint32 gRefCnt;
|
||||
static PRBool gGotTheme;
|
||||
static nsITheme* gTheme;
|
||||
|
||||
enum eMouseThrough {
|
||||
|
|
Загрузка…
Ссылка в новой задаче