Allow Windows to use system Vsync if only one window is swapping
commit9b71e13d22829c2df1620211049a6032628ebea8
authorbajones <bajones@chromium.org>
Fri, 2 Jan 2015 23:37:41 +0000 (2 15:37 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 2 Jan 2015 23:38:25 +0000 (2 23:38 +0000)
tree50e82a225d0d8adc6889ad67e4b7fbbe289f8d90
parentb1fc43cac3ab16b3218b72370225dd3a6456a671
Allow Windows to use system Vsync if only one window is swapping

This makes the common case (single browser window) smoother. Having
multiple swapping windows visible will force the previous behavior.

This patch differs from a previous variant (https://codereview.chromium.org/708483003)
in that there's now a "timeout" before we attempt turning on vsync again.
Specifically, we need to go for 60 frames without a frame where two
surfaces swap in order to turn Vsync on. This accounts for cases where
low-frequency updates in one window (blinking cursor) don't trigger
frequent vsync state changes. Also prevents pathologically bad cases
where two frequently updating windows would cause one another to skip
alternating frames.

BUG=422000

Review URL: https://codereview.chromium.org/749483002

Cr-Commit-Position: refs/heads/master@{#309861}
content/common/gpu/image_transport_surface.cc
ui/gl/gl_context_egl.cc
ui/gl/gl_context_egl.h
ui/gl/gl_surface.cc
ui/gl/gl_surface.h
ui/gl/gl_surface_egl.cc
ui/gl/gl_surface_egl.h