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

Unified Diff: ui/surface/accelerated_surface_win.cc

Issue 10825053: Use DwmGetCompositionTimingInfo to get vsync info on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change uint32_t to uint32 Created 8 years, 5 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
Index: ui/surface/accelerated_surface_win.cc
diff --git a/ui/surface/accelerated_surface_win.cc b/ui/surface/accelerated_surface_win.cc
index da77ac502f42fc2ca34eff16c073d8cd750e12de..a82018304d1837ea6b912f441aa147cd4c898a39 100644
--- a/ui/surface/accelerated_surface_win.cc
+++ b/ui/surface/accelerated_surface_win.cc
@@ -4,6 +4,7 @@
#include "ui/surface/accelerated_surface_win.h"
+#include <dwmapi.h>
#include <windows.h>
#include <algorithm>
@@ -833,6 +834,28 @@ void AcceleratedPresenter::DoReleaseSurface() {
source_texture_.Release();
}
+void AcceleratedPresenter::GetPresentationStats(base::TimeTicks *timebase,
+ uint32 *interval_n,
+ uint32 *interval_d) {
+ lock_.AssertAcquired();
+
+ DWM_TIMING_INFO timingInfo;
+ timingInfo.cbSize = sizeof(timingInfo);
+ HRESULT gctiResult = DwmGetCompositionTimingInfo(window_, &timingInfo);
+ if (gctiResult != S_OK)
+ return;
jbates 2012/07/28 01:35:30 2 space indent
+
+ // TODO: For scheduling purposes we can choose to synchronize to the
+ // vblank or composition time. If the composition time jitters, it may
+ // be better to rely on the vblank only. It may be even better to have
+ // animations depend on the vblank, but touch events and rendering to
+ // depend on composition time eventually.
+ *timebase = base::TimeTicks::FromQPCValue(
+ static_cast<LONGLONG>(timingInfo.qpcCompose));
+ *interval_n = timingInfo.rateCompose.uiNumerator;
+ *interval_d = timingInfo.rateCompose.uiDenominator;
+}
+
AcceleratedSurface::AcceleratedSurface(gfx::NativeWindow window)
: presenter_(g_accelerated_presenter_map.Pointer()->CreatePresenter(
window)) {

Powered by Google App Engine
This is Rietveld 408576698