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

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: Rebase on top of commited base/time changes Created 8 years, 4 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/surface/accelerated_surface_win.h ('k') | ui/ui.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/surface/accelerated_surface_win.cc
diff --git a/ui/surface/accelerated_surface_win.cc b/ui/surface/accelerated_surface_win.cc
index be55b6fbd567139272c2d88208beeb3359710611..199d9b9ccc09ce3728d04bb77109e35783556d3d 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>
@@ -861,6 +862,24 @@ void AcceleratedPresenter::DoReleaseSurface() {
source_texture_.Release();
}
+void AcceleratedPresenter::GetPresentationStats(base::TimeTicks* timebase,
+ uint32* interval_numerator,
+ uint32* interval_denominator) {
+ lock_.AssertAcquired();
+
+ DWM_TIMING_INFO timing_info;
+ timing_info.cbSize = sizeof(timing_info);
+ HRESULT result = DwmGetCompositionTimingInfo(window_, &timing_info);
+ if (result != S_OK)
+ return;
+
+ *timebase = base::TimeTicks::FromQPCValue(
+ static_cast<LONGLONG>(timing_info.qpcVBlank));
+ // Swap the numerator/denominator to convert frequency to period.
+ *interval_numerator = timing_info.rateRefresh.uiDenominator;
+ *interval_denominator = timing_info.rateRefresh.uiNumerator;
+}
+
AcceleratedSurface::AcceleratedSurface(gfx::NativeWindow window)
: presenter_(g_accelerated_presenter_map.Pointer()->CreatePresenter(
window)) {
« no previous file with comments | « ui/surface/accelerated_surface_win.h ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698