New issue
Advanced search Search tips

Issue 829137 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug

Blocking:
issue 825596
issue 825814
issue 828009



Sign in to add a comment

Window frame is painted way too often when scrolling the web content

Project Member Reported by bsep@chromium.org, Apr 4 2018

Issue description

I was measuring the performance overhead added by Windows 10 custom titlebar ( bug 505013 ) and despite the fact that it's only adding ~0.3ms to a 2-3ms function (GlassBrowserFrameView::OnPaint) it's still showing up in performance tests. The opaque frame takes longer to paint (~4ms) and no one complains about that.

It looks like we're painting the titlebar approximately every frame while scrolling a webpage. That seems wrong, since the titlebar is not changing at all. For reference, if you start a trace and do nothing, the titlebar is not repainted.

I also noticed the titlebar was repainted if you waggle the mouse in the non-interactive tabstrip background, but that may be expected.
 

Comment 1 by bsep@chromium.org, Apr 4 2018

Cc: brucedaw...@chromium.org
I suspect that the titlebar repainting on mouse waggles is also unintended, or at least avoidable.

Can you land your changes that add tracing events around the custom titlebar tracing?

Is it possible to land equivalent events for normal titlebar painting when the custom titlebar is disabled? I assume not (since Windows is doing that), but ???

Comment 3 by bsep@chromium.org, Apr 5 2018

I retested today and it looks like simply scrolling does NOT cause the titlebar to repaint, and neither does waggling the mouse over the non-interactive titlebar background. However, waggling the mouse over the active tab does cause it to repaint (even though nothing is changing).

That means this might not explain the perf test regressions though, since I think they're using synthetic mouse events to scroll the page.
Project Member

Comment 4 by bugdroid1@chromium.org, Apr 6 2018

Comment 5 by bsep@chromium.org, Apr 6 2018

Owner: davidbienvenu@chromium.org
This is the first time I've used chrome://tracing, but it looks to me like there's a fairly fixed minimum of PaintTitlebar calls on the initial display of a tab and switching back to the tab recording the trace - on the order of 60.
The vast majority of the paint calls are due to mousing over the title bar. If I start recording, use <cntrl> T to open a new tab, <cntrl> <shift> Tab to get to the about:tracing tab, and stop recording, I see 2 calls to LayoutTitleBar and 8 calls to paint. Using the mouse to switch to the about:recording tab causes ~45 calls to paint, which is consistent with what Bret described about waggling the mouse over the active tab.

Moving the mouse over the app menu seems to generate 2 or 3 paints of the title bar, even though it's not part of the title bar.

It looks like opening or switching tabs generates about 4 paints, so depending on what the performance tests are doing, I suppose it could show up.


I think the critical question is whether the amount of repainting is varying depending on whether we have the custom title bar enabled - assuming that we can determine that.

On the other hand, maybe that doesn't matter. If we own the title bar and if we are repainting it when nothing has changed then we should stop doing that.

Maybe we have some logic that triggers repaints on every mouse move event instead of on every mouse move event that changes state. That would end up being a small but important performance regression.

Turning off the custom title bar via the flag reduces the number of calls to OnPaint in both scenarios. <Cntrl> T <Cntrl> <Shift> Tab generates 7 calls to OnPaint and using the mouse to switch back to the previous tab generates ~31 calls to Paint instead of ~45. The former doesn't seem all that significant but the latter does, though 31 calls to OnPaint is still a surprising number.

Specifically, mousing over tabs generates a lot of OnPaint calls. Mousing elsewhere in the title bar doesn't.
I ran the perf test in https://bugs.chromium.org/p/chromium/issues/detail?id=825814 locally, with GlassBrowserFrameView tracing added to the benchmark tracing, and GlassBrowserFrameView::OnPaint is only called 5 times, so I doubt that perf test regression is due to the window frame getting painted more.  
Labels: Hotlist-DesktopUIValid Hotlist-DesktopUIChecked
***Mass UI Triage*** As per dev comments adding related labels for further triage.Thanks!

Sign in to add a comment