Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Issue 1097223002: Mac: Fix black flashing during tab switch (Closed)

Created:
5 years, 8 months ago by ccameron
Modified:
5 years, 8 months ago
Reviewers:
jbauman
CC:
chromium-reviews, jam, sievers+watch_chromium.org, jbauman+watch_chromium.org, darin-cc_chromium.org, kalyank, piman+watch_chromium.org, danakj+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Mac: Fix black flashing during tab switch This was not a new bug, but rather a worse manifestation of an existing bug. The existing bug occurred when a ui::Compositor was recycled. That is, when the compositor was detached from one NSView and then attached to a different NSView. The desired behavior is that, at the instant that the ui::Compositor is detached (in particular, ImageTransportFactory:: SetCompositorSuspendedForRecycle, called OnCompositorRecycled before this patch) is called, no more frames should be drawn into the compositor's output surface. This was previously accomplished by doing two things 1. Locking the ui::Compositor until the new NSView has a frame for it. 2. Making GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped not draw any frames that come in from the GPU process until after a call to GpuBrowserCompositorOutputSurface::SwapBuffers has occurred. This is to prevent swaps that were issued by the browser prior to the ui::Compositor being recycled from being shown. The assumption here was that the call to GpuBrowserCompositorOutputSurface::SwapBuffers would only be in response to new frame belonging to the new NSView. This is not a valid assumption now that the ui::Compositor uses a cc::Scheduler. In particular, the ui::Compositor may draw frames that have already been committed, even while it is locked. These previously-committed frames will call SwapBuffers when they are being drawn (which the logic will erroneously assume means that a frame from the new NSView is ready). To fix this, change this logic to make the output surface not draw any frames until the ui::Compositor commits a new frame and GpuBrowserCompositorOutputSurface::SwapBuffers is called. Also, the DiscardBackbuffer which is done to ensure that the same CALayer is not sent to two different tabs is now done immediately after the ui::Compositor does its commit for the new NSView (but before it does a draw) instead of being done immediately when the old NSView is removed. The old location was incorrect -- if there was a draw in flight, it would cause the backbuffer to be reallocated, and then the same CALayer would be used for the two tabs. Also, if the draw was a partial swap, then that frame would have black in the areas that were not drawn by the partial swap -- then, because the same CALayer was being used for the two tabs, we would get a flash of the semi-black frame in the new tab. BUG=477413 Committed: https://crrev.com/8d5d7278d7e06214bb87f170cda5c9ce9cf0c325 Cr-Commit-Position: refs/heads/master@{#326181}

Patch Set 1 #

Patch Set 2 : Wait for swap to draw frames #

Unified diffs Side-by-side diffs Delta from patch set Stats (+110 lines, -55 lines) Patch
M content/browser/compositor/browser_compositor_output_surface.h View 1 1 chunk +2 lines, -2 lines 0 comments Download
M content/browser/compositor/browser_compositor_view_mac.h View 3 chunks +12 lines, -2 lines 0 comments Download
M content/browser/compositor/browser_compositor_view_mac.mm View 3 chunks +13 lines, -3 lines 0 comments Download
M content/browser/compositor/gpu_browser_compositor_output_surface.h View 1 1 chunk +14 lines, -3 lines 0 comments Download
M content/browser/compositor/gpu_browser_compositor_output_surface.cc View 1 3 chunks +31 lines, -20 lines 0 comments Download
M content/browser/compositor/gpu_process_transport_factory.h View 1 1 chunk +4 lines, -2 lines 0 comments Download
M content/browser/compositor/gpu_process_transport_factory.cc View 1 2 chunks +7 lines, -6 lines 0 comments Download
M content/browser/compositor/image_transport_factory.h View 1 1 chunk +10 lines, -5 lines 0 comments Download
M content/browser/compositor/reflector_impl_unittest.cc View 1 1 chunk +4 lines, -2 lines 0 comments Download
M content/browser/compositor/software_browser_compositor_output_surface.h View 1 1 chunk +2 lines, -2 lines 0 comments Download
M content/browser/compositor/software_browser_compositor_output_surface.cc View 1 1 chunk +4 lines, -3 lines 0 comments Download
M content/browser/compositor/test/no_transport_image_transport_factory.h View 1 1 chunk +4 lines, -2 lines 0 comments Download
M content/browser/compositor/test/no_transport_image_transport_factory.cc View 1 1 chunk +2 lines, -2 lines 0 comments Download
M content/browser/gpu/gpu_process_host_ui_shim.cc View 1 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 10 (2 generated)
ccameron
Okay, after some reflection, I think this is the correct way to go. Calling ui::Compositor::SetVisible(false) ...
5 years, 8 months ago (2015-04-21 01:06:19 UTC) #2
jbauman
On 2015/04/21 01:06:19, ccameron wrote: > Okay, after some reflection, I think this is the ...
5 years, 8 months ago (2015-04-21 02:22:57 UTC) #3
ccameron
On 2015/04/21 02:22:57, jbauman wrote: > On 2015/04/21 01:06:19, ccameron wrote: > > Okay, after ...
5 years, 8 months ago (2015-04-21 03:04:49 UTC) #4
ccameron
On 2015/04/21 03:04:49, ccameron wrote: > On 2015/04/21 02:22:57, jbauman wrote: > > On 2015/04/21 ...
5 years, 8 months ago (2015-04-21 22:40:07 UTC) #5
jbauman
lgtm
5 years, 8 months ago (2015-04-21 22:43:45 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1097223002/20001
5 years, 8 months ago (2015-04-21 23:57:29 UTC) #8
commit-bot: I haz the power
Committed patchset #2 (id:20001)
5 years, 8 months ago (2015-04-22 00:01:47 UTC) #9
commit-bot: I haz the power
5 years, 8 months ago (2015-04-22 00:02:42 UTC) #10
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/8d5d7278d7e06214bb87f170cda5c9ce9cf0c325
Cr-Commit-Position: refs/heads/master@{#326181}

Powered by Google App Engine
This is Rietveld 408576698