Open
Bug 1348906
Opened 9 years ago
Updated 3 years ago
Stop using observer notifications for before-first-paint notifications to tabchild and zoomconstraintsclient consumers
Categories
(Core :: Layout, enhancement, P3)
Core
Layout
Tracking
()
NEW
| Tracking | Status | |
|---|---|---|
| firefox55 | --- | affected |
People
(Reporter: Gijs, Unassigned)
References
(Blocks 1 open bug)
Details
TabChildren and ZoomConstraintsClients listen for before-first-paint observer notifications.
Unfortunately, *every* tabchild does this, and every single one creates a listener that won't go away until its RecvDestroy() method is called. The actual Observe() implementation looks like this:
https://dxr.mozilla.org/mozilla-central/rev/1b9293be51637f841275541d8991314ca56561a5/dom/ipc/TabChild.cpp#456,461
> if (!strcmp(aTopic, BEFORE_FIRST_PAINT)) {
if (AsyncPanZoomEnabled()) {
nsCOMPtr<nsIDocument> subject(do_QueryInterface(aSubject));
nsCOMPtr<nsIDocument> doc(GetDocument());
> if (SameCOMIdentity(subject, doc)) {
nsCOMPtr<nsIPresShell> shell(doc->GetShell());
if (shell) {
shell->SetIsFirstPaint(true);
}
APZCCallbackHelper::InitializeRootDisplayport(shell);
}
}
}
This looks very much like it should be using some other pattern to have the presshell notify the TabChild. Right now every tabchild in the process will get these notifications, and every single one will have to check whether the document matches. That's O(n) for something that should be O(1).
The ZoomConstraintsClient has exactly the same problem.
https://dxr.mozilla.org/mozilla-central/rev/1b9293be51637f841275541d8991314ca56561a5/layout/base/ZoomConstraintsClient.cpp#151,153
Updated•9 years ago
|
Priority: -- → P3
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•