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)) { |