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

Side by Side Diff: ui/gl/gl_surface_win.cc

Issue 1143433005: Remove gfx::FrameTime for a single clock source (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handling patch for mac files Created 5 years, 7 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 unified diff | Download patch
« cc/scheduler/begin_frame_source.cc ('K') | « ui/gfx/gfx.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gl/gl_surface.h" 5 #include "ui/gl/gl_surface.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/trace_event/trace_event.h" 12 #include "base/trace_event/trace_event.h"
13 #include "base/win/windows_version.h" 13 #include "base/win/windows_version.h"
14 #include "ui/gfx/frame_time.h"
15 #include "ui/gfx/native_widget_types.h" 14 #include "ui/gfx/native_widget_types.h"
16 #include "ui/gl/gl_bindings.h" 15 #include "ui/gl/gl_bindings.h"
17 #include "ui/gl/gl_implementation.h" 16 #include "ui/gl/gl_implementation.h"
18 #include "ui/gl/gl_surface_egl.h" 17 #include "ui/gl/gl_surface_egl.h"
19 #include "ui/gl/gl_surface_osmesa.h" 18 #include "ui/gl/gl_surface_osmesa.h"
20 #include "ui/gl/gl_surface_stub.h" 19 #include "ui/gl/gl_surface_stub.h"
21 #include "ui/gl/gl_surface_wgl.h" 20 #include "ui/gl/gl_surface_wgl.h"
22 21
23 // From ANGLE's egl/eglext.h. 22 // From ANGLE's egl/eglext.h.
24 #if !defined(EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE) 23 #if !defined(EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 base::TimeDelta rate_interval; 81 base::TimeDelta rate_interval;
83 if (timing_info.rateRefresh.uiDenominator > 0 && 82 if (timing_info.rateRefresh.uiDenominator > 0 &&
84 timing_info.rateRefresh.uiNumerator > 0) { 83 timing_info.rateRefresh.uiNumerator > 0) {
85 // Swap the numerator/denominator to convert frequency to period. 84 // Swap the numerator/denominator to convert frequency to period.
86 rate_interval = base::TimeDelta::FromMicroseconds( 85 rate_interval = base::TimeDelta::FromMicroseconds(
87 timing_info.rateRefresh.uiDenominator * 86 timing_info.rateRefresh.uiDenominator *
88 base::Time::kMicrosecondsPerSecond / 87 base::Time::kMicrosecondsPerSecond /
89 timing_info.rateRefresh.uiNumerator); 88 timing_info.rateRefresh.uiNumerator);
90 } 89 }
91 90
92 if (gfx::FrameTime::TimestampsAreHighRes()) { 91 if (base::TimeTicks::IsHighResolution()) {
93 // qpcRefreshPeriod is very accurate but noisy, and must be used with 92 // qpcRefreshPeriod is very accurate but noisy, and must be used with
94 // a high resolution timebase to avoid frequently missing Vsync. 93 // a high resolution timebase to avoid frequently missing Vsync.
95 timebase = gfx::FrameTime::FromQPCValue( 94 timebase = base::TimeTicks::FromQPCValue(
96 static_cast<LONGLONG>(timing_info.qpcVBlank)); 95 static_cast<LONGLONG>(timing_info.qpcVBlank));
97 interval = base::TimeDelta::FromQPCValue( 96 interval = base::TimeDelta::FromQPCValue(
98 static_cast<LONGLONG>(timing_info.qpcRefreshPeriod)); 97 static_cast<LONGLONG>(timing_info.qpcRefreshPeriod));
99 // Check for interval values that are impossibly low. A 29 microsecond 98 // Check for interval values that are impossibly low. A 29 microsecond
100 // interval was seen (from a qpcRefreshPeriod of 60). 99 // interval was seen (from a qpcRefreshPeriod of 60).
101 if (interval < base::TimeDelta::FromMilliseconds(1)) { 100 if (interval < base::TimeDelta::FromMilliseconds(1)) {
102 interval = rate_interval; 101 interval = rate_interval;
103 } 102 }
104 // Check for the qpcRefreshPeriod interval being improbably small 103 // Check for the qpcRefreshPeriod interval being improbably small
105 // compared to the rateRefresh calculated interval, as another 104 // compared to the rateRefresh calculated interval, as another
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 NOTREACHED(); 356 NOTREACHED();
358 return NULL; 357 return NULL;
359 } 358 }
360 } 359 }
361 360
362 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { 361 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() {
363 return GetDC(NULL); 362 return GetDC(NULL);
364 } 363 }
365 364
366 } // namespace gfx 365 } // namespace gfx
OLDNEW
« cc/scheduler/begin_frame_source.cc ('K') | « ui/gfx/gfx.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698