From 398ff0bdf8f314a6f98d8d7ea348ea89d44aa7b3 Mon Sep 17 00:00:00 2001 From: ccameron Date: Thu, 12 Mar 2015 15:29:11 -0700 Subject: Mac: Don't force an immediate draw during tab-switch I introduced this behavior in https://codereview.chromium.org/810333005 with the reasoning that by forcing an immediate draw, we will tab-switch faster. That reasoning is still true, but after cleaning up a number of other sources of slow tab-switch, I found that, while this un-blocks tab-switch faster, the window system doesn't like it when these draws are forced. In particular, it will often just flash a blank frame for the remote CALayer. If we were okay with a flash of a blank frame, then we won't do the stall waiting for a frame to begin with. BUG=463988 Review URL: https://codereview.chromium.org/1004513003 Cr-Commit-Position: refs/heads/master@{#320392} --- content/common/gpu/image_transport_surface_calayer_mac.mm | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/content/common/gpu/image_transport_surface_calayer_mac.mm b/content/common/gpu/image_transport_surface_calayer_mac.mm index 50cbaea3..064c277 100644 --- a/content/common/gpu/image_transport_surface_calayer_mac.mm +++ b/content/common/gpu/image_transport_surface_calayer_mac.mm @@ -193,11 +193,6 @@ void CALayerStorageProvider::SwapBuffers( [context_ retain]; } - // If we create a new layer, always force it to draw immediately. This is - // especially important at tab-switch, where we don't want to wait for a - // vsync to un-block the browser (which is waiting for the frame to come in). - bool force_immediate_draw = false; - // Allocate a CALayer to use to draw the content and make it current to the // CAContext, if needed. if (!layer_) { @@ -208,7 +203,6 @@ void CALayerStorageProvider::SwapBuffers( [layer_ setFrame:CGRectMake(0, 0, dip_size.width(), dip_size.height())]; [context_ setLayer:layer_]; - force_immediate_draw = true; } // Replacing the CAContext's CALayer will sometimes results in an immediate @@ -217,7 +211,7 @@ void CALayerStorageProvider::SwapBuffers( return; // Tell CoreAnimation to draw our frame. - if (gpu_vsync_disabled_ || throttling_disabled_ || force_immediate_draw) { + if (gpu_vsync_disabled_ || throttling_disabled_) { DrawImmediatelyAndUnblockBrowser(); } else { if (![layer_ isAsynchronous]) -- cgit v1.1