Bug 1342863 - (Part 4) DocGroup labeling for runnables dispatched by NS_DispatchTo(Main|Current)Thread in nsDocumentViewer. r?dholbert
MozReview-Commit-ID: 9f32OTpim7V
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -2130,17 +2130,21 @@ nsDocumentViewer::Show(void)
if (mPresShell) {
nsCOMPtr<nsIPresShell> shell(mPresShell); // bug 378682
shell->UnsuppressPainting();
}
}
// Notify observers that a new page has been shown. This will get run
// from the event loop after we actually draw the page.
- NS_DispatchToMainThread(new nsDocumentShownDispatcher(mDocument));
+ RefPtr<nsDocumentShownDispatcher> event =
+ new nsDocumentShownDispatcher(mDocument);
+ mDocument->Dispatch("nsDocumentShownDispatcher",
+ TaskCategory::Other,
+ event.forget());
return NS_OK;
}
NS_IMETHODIMP
nsDocumentViewer::Hide(void)
{
if (!mAttachedToParent && mWindow) {
@@ -4622,9 +4626,8 @@ nsDocumentShownDispatcher::Run()
{
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
if (observerService) {
observerService->NotifyObservers(mDocument, "document-shown", nullptr);
}
return NS_OK;
}
-