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

Side by Side Diff: ui/gfx/frame_time.h

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 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
« no previous file with comments | « ui/events/latency_info.cc ('k') | ui/gl/gl_surface_egl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef UI_GFX_FRAME_TIME_H 5 #ifndef UI_GFX_FRAME_TIME_H
6 #define UI_GFX_FRAME_TIME_H 6 #define UI_GFX_FRAME_TIME_H
7 7
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 namespace gfx { 11 namespace gfx {
12 12
13 // FrameTime::Now() should be used to get timestamps with a timebase that 13 // FrameTime::Now() should be used to get timestamps with a timebase that
14 // is consistent across the graphics stack. 14 // is consistent across the graphics stack.
15 class FrameTime { 15 class FrameTime {
16 public: 16 public:
17 static base::TimeTicks Now() { 17 static base::TimeTicks Now() {
18 if (TimestampsAreHighRes())
19 return base::TimeTicks::HighResNow();
20 return base::TimeTicks::Now(); 18 return base::TimeTicks::Now();
21 } 19 }
22 20
23 #if defined(OS_WIN) 21 #if defined(OS_WIN)
24 static base::TimeTicks FromQPCValue(LONGLONG qpc_value) { 22 static base::TimeTicks FromQPCValue(LONGLONG qpc_value) {
25 DCHECK(TimestampsAreHighRes()); 23 DCHECK(TimestampsAreHighRes());
26 return base::TimeTicks::FromQPCValue(qpc_value); 24 return base::TimeTicks::FromQPCValue(qpc_value);
27 } 25 }
28 #endif 26 #endif
29 27
30 static bool TimestampsAreHighRes() { 28 static bool TimestampsAreHighRes() {
31 // This should really return base::TimeTicks::IsHighResNowFastAndReliable(); 29 // This should really return base::TimeTicks::IsHighResNowFastAndReliable();
32 // Returning false makes sure we are only using low-res timestamps until we 30 // Returning false makes sure we are only using low-res timestamps until we
33 // use FrameTime everywhere we need to. See crbug.com/315334 31 // use FrameTime everywhere we need to. See crbug.com/315334
34 return false; 32 return false;
35 } 33 }
36 }; 34 };
37 35
38 } 36 }
39 37
40 #endif // UI_GFX_FRAME_TIME_H 38 #endif // UI_GFX_FRAME_TIME_H
OLDNEW
« no previous file with comments | « ui/events/latency_info.cc ('k') | ui/gl/gl_surface_egl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698