From 0c89354f714f107e2d15577c9e415adbe5f03b29 Mon Sep 17 00:00:00 2001 From: Nicolas Roard Date: Thu, 3 Mar 2011 10:16:31 -0800 Subject: [PATCH] Do not merge: Cherry-pick change I9942e8e4 from master Wait the remaining of the 60FPS cap delay rather than not paint. Returning true if called faster than 60FPS means we are not drawing and ask for the framework to call us again; this works in general because the framework recopy the previous framebuffer. But in some cases, it didn't, causing the webview to flicker. A correct fix would be to introduce the capping in framework rather than try to doing it in the webview; in the meantime we will sleep the remaining of the delay as a workaround, so that we still provide the GPU benefits we wanted (at >60FPS the GPU was being saturated in some cases). bug:3500655 Change-Id: Ibaa1d93e0a13433a2c842b19b58538894fdaa7e4 --- WebCore/platform/graphics/android/GLWebViewState.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/WebCore/platform/graphics/android/GLWebViewState.cpp b/WebCore/platform/graphics/android/GLWebViewState.cpp index 5e1285f3d..20a231c5f 100644 --- a/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -342,8 +342,10 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, float scale, SkColo double currentTime = WTF::currentTime(); double delta = currentTime - m_prevDrawTime; - if (delta < FRAMERATE_CAP) - return true; + if (delta < FRAMERATE_CAP) { + unsigned int usecs = (FRAMERATE_CAP - delta) * 1E6; + usleep(usecs); + } m_prevDrawTime = currentTime; -- 2.11.0