| OLD | NEW |
| 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 return base::TimeTicks::Now(); | 18 return base::TimeTicks::Now(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 #if defined(OS_WIN) | |
| 22 static base::TimeTicks FromQPCValue(LONGLONG qpc_value) { | |
| 23 DCHECK(TimestampsAreHighRes()); | |
| 24 return base::TimeTicks::FromQPCValue(qpc_value); | |
| 25 } | |
| 26 #endif | |
| 27 | |
| 28 static bool TimestampsAreHighRes() { | 21 static bool TimestampsAreHighRes() { |
| 29 // This should really return base::TimeTicks::IsHighResNowFastAndReliable(); | 22 // This should really return base::TimeTicks::IsHighResNowFastAndReliable(); |
| 30 // Returning false makes sure we are only using low-res timestamps until we | 23 // Returning false makes sure we are only using low-res timestamps until we |
| 31 // use FrameTime everywhere we need to. See crbug.com/315334 | 24 // use FrameTime everywhere we need to. See crbug.com/315334 |
| 32 return false; | 25 return false; |
| 33 } | 26 } |
| 34 }; | 27 }; |
| 35 | 28 |
| 36 } | 29 } |
| 37 | 30 |
| 38 #endif // UI_GFX_FRAME_TIME_H | 31 #endif // UI_GFX_FRAME_TIME_H |
| OLD | NEW |