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

Unified Diff: ui/gl/gl_surface_win.cc

Issue 27710005: cc: Use HighResNow as timebase if it is fast and reliable (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix DCHECK Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/gfx.gyp ('k') | ui/surface/accelerated_surface_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_surface_win.cc
diff --git a/ui/gl/gl_surface_win.cc b/ui/gl/gl_surface_win.cc
index d535c06a12a611ab022c8804ee6becc5683b4b92..ff2ed84267ccf6d0fd2bee91ff977495481b3b45 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) {
« no previous file with comments | « ui/gfx/gfx.gyp ('k') | ui/surface/accelerated_surface_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698