Bug 674112 - Make nsNavigator participate to the DOM Memory Reporter. r=jst

This commit is contained in:
Mounir Lamouri 2011-08-09 14:58:41 +02:00
Родитель f3aa337ce8
Коммит d6059627f3
2 изменённых файлов: 34 добавлений и 9 удалений

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

@ -10075,6 +10075,19 @@ nsGlobalWindow::HasPerformanceSupport()
return Preferences::GetBool("dom.enable_performance", PR_FALSE);
}
PRInt64
nsGlobalWindow::SizeOf() const
{
PRInt64 size = sizeof(*this);
if (IsInnerWindow() && mDoc) {
size += mDoc->SizeOf();
}
size += mNavigator ? mNavigator->SizeOf() : 0;
return size;
}
// nsGlobalChromeWindow implementation
@ -11227,3 +11240,21 @@ NS_IMETHODIMP nsNavigator::GetMozNotification(nsIDOMDesktopNotificationCenter **
NS_ADDREF(*aRetVal = mNotification);
return NS_OK;
}
PRInt64
nsNavigator::SizeOf() const
{
PRInt64 size = sizeof(*this);
// TODO: add SizeOf() to nsMimeTypeArray, bug 674113.
size += mMimeTypes ? sizeof(*mMimeTypes.get()) : 0;
// TODO: add SizeOf() to nsPluginArray, bug 674114.
size += mPlugins ? sizeof(*mPlugins.get()) : 0;
// TODO: add SizeOf() to nsGeolocation, bug 674115.
size += mGeolocation ? sizeof(*mGeolocation.get()) : 0;
// TODO: add SizeOf() to nsDesktopNotificationCenter, bug 674116.
size += mNotification ? sizeof(*mNotification.get()) : 0;
return size;
}

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

@ -538,15 +538,7 @@ public:
return sWindowsById;
}
PRInt64 SizeOf() const {
PRInt64 size = sizeof(*this);
if (IsInnerWindow() && mDoc) {
size += mDoc->SizeOf();
}
return size;
}
PRInt64 SizeOf() const;
private:
// Enable updates for the accelerometer.
@ -1076,6 +1068,8 @@ public:
static bool HasDesktopNotificationSupport();
PRInt64 SizeOf() const;
protected:
nsRefPtr<nsMimeTypeArray> mMimeTypes;
nsRefPtr<nsPluginArray> mPlugins;