Bug 568975 - m-c message manager slowed down event handling a bit, r=jst

--HG--
extra : rebase_source : 33a1b10f31760b69a565645f43062f872b136b98
This commit is contained in:
Olli Pettay 2010-06-10 13:05:31 +03:00
Родитель 447c31cf6a
Коммит bedc9abcaf
2 изменённых файлов: 18 добавлений и 8 удалений

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

@ -943,6 +943,7 @@ nsGlobalWindow::CleanUp(PRBool aIgnoreModalDialog)
mContext = nsnull; // Forces Release
}
mChromeEventHandler = nsnull; // Forces Release
mParentTarget = nsnull;
nsGlobalWindow *inner = GetCurrentInnerWindowInternal();
@ -1197,6 +1198,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGlobalWindow)
// Traverse stuff from nsPIDOMWindow
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mChromeEventHandler)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mParentTarget)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFrameElement)
@ -1230,6 +1232,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
// Unlink stuff from nsPIDOMWindow
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mChromeEventHandler)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mParentTarget)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mFrameElement)
@ -2399,16 +2402,19 @@ nsGlobalWindow::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
}
}
nsPIDOMEventTarget* chromeTarget = mChromeEventHandler;
nsCOMPtr<nsIFrameLoaderOwner> flo = do_QueryInterface(mChromeEventHandler);
if (flo) {
nsRefPtr<nsFrameLoader> fl = flo->GetFrameLoader();
if (fl) {
nsPIDOMEventTarget* t = fl->GetTabChildGlobalAsEventTarget();
chromeTarget = t ? t : chromeTarget;
if (!mParentTarget) {
nsCOMPtr<nsIFrameLoaderOwner> flo = do_QueryInterface(mChromeEventHandler);
if (flo) {
nsRefPtr<nsFrameLoader> fl = flo->GetFrameLoader();
if (fl) {
mParentTarget = fl->GetTabChildGlobalAsEventTarget();
}
}
if (!mParentTarget) {
mParentTarget = mChromeEventHandler;
}
}
aVisitor.mParentTarget = chromeTarget;
aVisitor.mParentTarget = mParentTarget;
return NS_OK;
}

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

@ -524,6 +524,8 @@ protected:
void SetChromeEventHandlerInternal(nsPIDOMEventTarget* aChromeEventHandler) {
mChromeEventHandler = aChromeEventHandler;
// mParentTarget will be set when the next event is dispatched.
mParentTarget = nsnull;
}
// These two variables are special in that they're set to the same
@ -532,6 +534,8 @@ protected:
nsCOMPtr<nsPIDOMEventTarget> mChromeEventHandler; // strong
nsCOMPtr<nsIDOMDocument> mDocument; // strong
nsCOMPtr<nsPIDOMEventTarget> mParentTarget; // strong
// These members are only used on outer windows.
nsCOMPtr<nsIDOMElement> mFrameElement;
nsIDocShell *mDocShell; // Weak Reference