Closed
Bug 1367830
Opened 7 years ago
Closed 5 years ago
mark hidden window as inactive (so we will soon not run the refresh driver in the hidden window)
Categories
(Core :: Layout, enhancement, P2)
Core
Layout
Tracking
()
RESOLVED
FIXED
mozilla70
Tracking | Status | |
---|---|---|
firefox70 | --- | fixed |
People
(Reporter: dbaron, Assigned: dbaron)
References
Details
(Keywords: perf)
Attachments
(3 files)
Right now we run the refresh driver in the hidden window, which causes some (reasonably simple) reflows during startup.
We should also ensure that PresShell::SetIsActive(false) happens on the hidden window's pres shell.
(But see also bug 71895.)
Assignee | ||
Comment 1•7 years ago
|
||
A naive, untested patch to mark it as inactive is https://hg.mozilla.org/users/dbaron_mozilla.com/patches/raw-file/9ee0e6dc1793/mark-hidden-window-inactive
Assignee | ||
Comment 2•7 years ago
|
||
(I'm not planning to work on this further now.)
Assignee | ||
Comment 3•7 years ago
|
||
On the other hand, if we do bug 1352205 in full (which is sounding likely), this patch might be all we need.
Assignee | ||
Comment 4•7 years ago
|
||
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment 9•7 years ago
|
||
mozreview-review |
Comment on attachment 8871536 [details]
Bug 1367830 - Refactor to share more code between private and non-private hidden window creation.
https://reviewboard.mozilla.org/r/143008/#review147048
::: xpfe/appshell/nsAppShellService.cpp:144
(Diff revision 2)
> - rv = JustCreateTopWindow(nullptr, url,
> + rv = JustCreateTopWindow(nullptr, url,
> - chromeMask, initialWidth, initialHeight,
> + chromeMask, initialWidth, initialHeight,
> - true, nullptr, nullptr, getter_AddRefs(newWindow));
> + true, nullptr, nullptr, getter_AddRefs(newWindow));
> - NS_ENSURE_SUCCESS(rv, rv);
> + NS_ENSURE_SUCCESS(rv, rv);
>
> + {
Is it necessary to Release() the docShell before swapping the private window? This extra scope seems ugly & unnecessary.
::: xpfe/appshell/nsAppShellService.cpp:147
(Diff revision 2)
> if (docShell) {
> + if (aIsPrivate) {
This is really ugly - I would ask you to merge into `if (aIsPrivate && docShell)` except that you need the `docShell` for non-private windows in part 2.
::: xpfe/appshell/nsAppShellService.cpp:154
(Diff revision 2)
> - docShell->SetAffectPrivateSessionLifetime(false);
> + docShell->SetAffectPrivateSessionLifetime(false);
> - }
> + }
> + }
> + }
>
> + if (!aIsPrivate) {
Can we flip this if statement? Other if statements here use (aIsPrivate) not (!aIsPrivate)
::: xpfe/appshell/nsAppShellService.cpp:157
(Diff revision 2)
> + }
>
> + if (!aIsPrivate) {
> + mHiddenWindow.swap(newWindow);
> + } else {
> + // We created the hidden private window
This comment feels silly here
::: xpfe/appshell/nsAppShellService.cpp:161
(Diff revision 2)
> + } else {
> + // We created the hidden private window
> mHiddenPrivateWindow.swap(newWindow);
> }
>
> // RegisterTopLevelWindow(newWindow); -- Mac only
This isn't an issue with your patch, but I still find this very confusing. What is the purpose of this comment? It appears from blame to have just floated around here since the netscape days.
Attachment #8871536 -
Flags: review?(michael) → review+
Comment 10•7 years ago
|
||
mozreview-review |
Comment on attachment 8871537 [details]
Bug 1367830 - Mark hidden window as inactive.
https://reviewboard.mozilla.org/r/143010/#review147054
Attachment #8871537 -
Flags: review?(michael) → review+
Assignee | ||
Updated•7 years ago
|
Summary: don't run the refresh driver in the hidden window → mark hidden window as inactive (so we will soon not run the refresh driver in the hidden window)
Assignee | ||
Comment 11•7 years ago
|
||
mozreview-review |
Comment on attachment 8871536 [details]
Bug 1367830 - Refactor to share more code between private and non-private hidden window creation.
https://reviewboard.mozilla.org/r/143008/#review147064
::: xpfe/appshell/nsAppShellService.cpp:144
(Diff revision 2)
> - rv = JustCreateTopWindow(nullptr, url,
> + rv = JustCreateTopWindow(nullptr, url,
> - chromeMask, initialWidth, initialHeight,
> + chromeMask, initialWidth, initialHeight,
> - true, nullptr, nullptr, getter_AddRefs(newWindow));
> + true, nullptr, nullptr, getter_AddRefs(newWindow));
> - NS_ENSURE_SUCCESS(rv, rv);
> + NS_ENSURE_SUCCESS(rv, rv);
>
> + {
Not particularly, but it seemed like a good idea; often leads to less destructor code to keep scopes small, although it doesn't particularly matter here. I guess I'll drop it.
::: xpfe/appshell/nsAppShellService.cpp:147
(Diff revision 2)
> if (docShell) {
> + if (aIsPrivate) {
Yeah, I did it this way so I wouldn't have to change it again in part 2.
::: xpfe/appshell/nsAppShellService.cpp:154
(Diff revision 2)
> - docShell->SetAffectPrivateSessionLifetime(false);
> + docShell->SetAffectPrivateSessionLifetime(false);
> - }
> + }
> + }
> + }
>
> + if (!aIsPrivate) {
Sure.
::: xpfe/appshell/nsAppShellService.cpp:157
(Diff revision 2)
> + }
>
> + if (!aIsPrivate) {
> + mHiddenWindow.swap(newWindow);
> + } else {
> + // We created the hidden private window
Yeah, I was trying to preserve the old comment, but I'll drop it.
::: xpfe/appshell/nsAppShellService.cpp:161
(Diff revision 2)
> + } else {
> + // We created the hidden private window
> mHiddenPrivateWindow.swap(newWindow);
> }
>
> // RegisterTopLevelWindow(newWindow); -- Mac only
Oops, meant to delete this comment, but forgot. I'll do so.
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment 14•7 years ago
|
||
Pushed by dbaron@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/48ee194df638
Refactor to share more code between private and non-private hidden window creation. r=mystor
https://hg.mozilla.org/integration/autoland/rev/d706d716fcbb
Mark hidden window as inactive. r=mystor
Comment 15•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/48ee194df638
https://hg.mozilla.org/mozilla-central/rev/d706d716fcbb
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Updated•7 years ago
|
Assignee: nobody → dbaron
Assignee | ||
Comment 16•7 years ago
|
||
I've been meaning to follow up here: this didn't actually do much because it doesn't actually propagate to the PresShell for some reason; I've been meaning to debug that.
Assignee | ||
Comment 17•7 years ago
|
||
That's because of the test at the start of nsDocShell::SetIsActive. Basically, the patches here so far haven't done anything yet. (I'd meant to test, but it managed to drop off my list of things to do during the QF work week...)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Updated•7 years ago
|
Assignee | ||
Comment 18•7 years ago
|
||
With that removed, I no longer see reflows in the hidden window triggered from vsync refresh driver timer ticks.
Assignee | ||
Comment 19•7 years ago
|
||
Assignee | ||
Comment 20•7 years ago
|
||
Assignee | ||
Comment 21•7 years ago
|
||
Assignee | ||
Comment 22•7 years ago
|
||
So my patch here is causing a single mochitest failure (visible in the above try runs):
FAIL | chrome://mochitests/content/a11y/accessible/tests/mochitest/events/test_docload.html | Scenario #0 of test with ID = 'open dialog '../events/docload_wnd.html'' failed. Dupe reorder event.
From the history it looks like this is something that's been worked around before. I'm curious if you have any advice on how to approach investigating this failure -- either adjusting the test, or figuring out whether there's a real problem as a result of the hidden window being inactive and having a slower refresh driver cycle.
Flags: needinfo?(surkov.alexander)
Comment 23•7 years ago
|
||
Sorry for delay in answering. It makes sense to disable all tests but openWndShutdownDoc in events/test_docload.html to reduce the noise, and then add lines:
gA11yEventDumpToConsole = true;
enableLogging("tree,doclifecycle");
This will provide a log that may explain why we get second reorder event on a root accessible.
Flags: needinfo?(surkov.alexander)
Updated•7 years ago
|
Priority: -- → P2
Assignee | ||
Comment 24•7 years ago
|
||
I should see what effects bug 638313 had.
Assignee | ||
Comment 25•7 years ago
|
||
Assignee | ||
Comment 26•7 years ago
|
||
This is to allow the hidden window to become inactive.
The code being removed dates to the origin of the function in bug 343515
(changeset b7836c3a63dba95c983bde1ae4402386c877640b, August 2010).
MozReview-Commit-ID: Edf2zcINpiA
Attachment #8923887 -
Flags: review?(nika)
Comment 27•7 years ago
|
||
Comment on attachment 8923887 [details] [diff] [review]
Allow setting chrome docshells as inactive
Review of attachment 8923887 [details] [diff] [review]:
-----------------------------------------------------------------
This seems like a reasonable change assuming that tests still pass.
Attachment #8923887 -
Flags: review?(nika) → review+
Assignee | ||
Comment 28•7 years ago
|
||
More complete test run here, since the all-tests-on-Linux one above passed:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=e72a8a015223180807b5ea9bd762ad62ec1bd29d&group_state=expanded
Assignee | ||
Comment 29•7 years ago
|
||
OK, in the new run there are a bunch of:
accessible/tests/mochitest/events/docload/test_docload_shutdown.html | Scenario #0 of test with ID = 'open dialog '../../events/docload/docload_wnd.html'' failed. Dupe reorder event.
Assignee | ||
Comment 30•5 years ago
|
||
I'd forgotten about this one, but here's a new try run.
Assignee | ||
Comment 31•5 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/6692575191f32991dd8ceb2b108dd2adaba576f0
Bug 1367830 - Allow setting chrome docshells as inactive. r=nika
Comment 32•5 years ago
|
||
bugherder |
Status: REOPENED → RESOLVED
Closed: 7 years ago → 5 years ago
status-firefox70:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
You need to log in
before you can comment on or make changes to this bug.
Description
•