summaryrefslogtreecommitdiffstats
path: root/ui/gl
diff options
context:
space:
mode:
authorbrianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-25 19:46:46 +0000
committerbrianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-25 19:46:46 +0000
commitde2cf8caf24f9dff41462b4ed164d18c553b30e3 (patch)
tree9b7833a432e15c49b8217d529e17cc474c0e47af /ui/gl
parent406e93caa0d00078548cbbb830767f5cc976e32d (diff)
downloadchromium_src-de2cf8caf24f9dff41462b4ed164d18c553b30e3.zip
chromium_src-de2cf8caf24f9dff41462b4ed164d18c553b30e3.tar.gz
chromium_src-de2cf8caf24f9dff41462b4ed164d18c553b30e3.tar.bz2
cc: Use HighResNow as timebase if it is fast and reliable
If base::TimeTicks::HighResNow is fast and reliable, we use it for frame times, animations, and scheduling. Otherwise, we use base::TimeTicks::Now and use a timebase of zero to avoid an incorrect or jittery timebase. This adds a gfx::FrameTime::Now() function, so the same timebase is used across the ui and cc directories. Additionally, the OutputSurface now uses a HighRes version of the DelayBasedTimesource if gfx::FrameTime::Now() is HighRes. BUG=303356 Review URL: https://codereview.chromium.org/27710005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231089 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gl')
-rw-r--r--ui/gl/gl_surface_win.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/ui/gl/gl_surface_win.cc b/ui/gl/gl_surface_win.cc
index d535c06..ff2ed84 100644
--- a/ui/gl/gl_surface_win.cc
+++ b/ui/gl/gl_surface_win.cc
@@ -11,6 +11,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/win/windows_version.h"
#include "third_party/mesa/src/include/GL/osmesa.h"
+#include "ui/gfx/frame_time.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_surface_egl.h"
@@ -56,8 +57,16 @@ class DWMVSyncProvider : public VSyncProvider {
if (result != S_OK)
return;
- base::TimeTicks timebase = base::TimeTicks::FromQPCValue(
- static_cast<LONGLONG>(timing_info.qpcVBlank));
+ base::TimeTicks timebase;
+ // If FrameTime is not high resolution, we do not want to translate the
+ // QPC value provided by DWM into the low-resolution timebase, which
+ // would be error prone and jittery. As a fallback, we assume the timebase
+ // is zero.
+ if (gfx::FrameTime::TimestampsAreHighRes()) {
+ timebase = gfx::FrameTime::FromQPCValue(
+ static_cast<LONGLONG>(timing_info.qpcVBlank));
+ }
+
// Swap the numerator/denominator to convert frequency to period.
if (timing_info.rateRefresh.uiDenominator > 0 &&
timing_info.rateRefresh.uiNumerator > 0) {