Index: base/time/time_win.cc |
diff --git a/base/time/time_win.cc b/base/time/time_win.cc |
index d2403f21b7ff5538f0449bde39e423a5777f8998..91444830009097bed18067285cdb50ca7e9771a7 100644 |
--- a/base/time/time_win.cc |
+++ b/base/time/time_win.cc |
@@ -36,6 +36,7 @@ |
#pragma comment(lib, "winmm.lib") |
#include <windows.h> |
#include <mmsystem.h> |
+#include <stdint.h> |
#include "base/basictypes.h" |
#include "base/cpu.h" |
@@ -43,9 +44,11 @@ |
#include "base/logging.h" |
#include "base/synchronization/lock.h" |
+using base::ThreadTicks; |
using base::Time; |
using base::TimeDelta; |
using base::TimeTicks; |
+using base::TraceTicks; |
namespace { |
@@ -106,7 +109,7 @@ base::LazyInstance<base::Lock>::Leaky g_high_res_lock = |
// number of leap year days between 1601 and 1970: (1970-1601)/4 excluding |
// 1700, 1800, and 1900. |
// static |
-const int64 Time::kTimeTToMicrosecondsOffset = GG_INT64_C(11644473600000000); |
+const int64 Time::kTimeTToMicrosecondsOffset = INT64_C(11644473600000000); |
// static |
Time Time::Now() { |
@@ -328,7 +331,7 @@ base::Lock g_rollover_lock; |
// which will roll over the 32-bit value every ~49 days. We try to track |
// rollover ourselves, which works if TimeTicks::Now() is called at least every |
// 49 days. |
-TimeTicks RolloverProtectedNow() { |
+TimeDelta RolloverProtectedNow() { |
base::AutoLock locked(g_rollover_lock); |
// We should hold the lock while calling tick_function to make sure that |
// we keep last_seen_now stay correctly in sync. |
@@ -336,7 +339,7 @@ TimeTicks RolloverProtectedNow() { |
if (now < g_last_seen_now) |
g_rollover_ms += 0x100000000I64; // ~49.7 days. |
g_last_seen_now = now; |
- return TimeTicks() + TimeDelta::FromMilliseconds(now + g_rollover_ms); |
+ return TimeDelta::FromMilliseconds(now + g_rollover_ms); |
} |
// Discussion of tick counter options on Windows: |
@@ -374,10 +377,10 @@ TimeTicks RolloverProtectedNow() { |
// this timer; and also other Windows applications can alter it, affecting this |
// one. |
-using NowFunction = TimeTicks (*)(void); |
+using NowFunction = TimeDelta (*)(void); |
-TimeTicks InitialNowFunction(); |
-TimeTicks InitialSystemTraceNowFunction(); |
+TimeDelta InitialNowFunction(); |
+TimeDelta InitialSystemTraceNowFunction(); |
// See "threading notes" in InitializeNowFunctionPointers() for details on how |
// concurrent reads/writes to these globals has been made safe. |
@@ -413,10 +416,10 @@ TimeDelta QPCValueToTimeDelta(LONGLONG qpc_value) { |
g_qpc_ticks_per_second)); |
} |
-TimeTicks QPCNow() { |
+TimeDelta QPCNow() { |
LARGE_INTEGER now; |
QueryPerformanceCounter(&now); |
- return TimeTicks() + QPCValueToTimeDelta(now.QuadPart); |
+ return QPCValueToTimeDelta(now.QuadPart); |
} |
bool IsBuggyAthlon(const base::CPU& cpu) { |
@@ -429,12 +432,12 @@ void InitializeNowFunctionPointers() { |
if (!QueryPerformanceFrequency(&ticks_per_sec)) |
ticks_per_sec.QuadPart = 0; |
- // If Windows cannot provide a QPC implementation, both Now() and |
- // NowFromSystemTraceTime() must use the low-resolution clock. |
+ // If Windows cannot provide a QPC implementation, both TimeTicks::Now() and |
+ // TraceTicks::Now() must use the low-resolution clock. |
// |
- // If the QPC implementation is expensive and/or unreliable, Now() will use |
- // the low-resolution clock, but NowFromSystemTraceTime() will use the QPC (in |
- // the hope that it is still useful for tracing purposes). A CPU lacking a |
+ // If the QPC implementation is expensive and/or unreliable, TimeTicks::Now() |
+ // will use the low-resolution clock, but TraceTicks::Now() will use the QPC |
+ // (in the hope that it is still useful for tracing purposes). A CPU lacking a |
// non-stop time counter will cause Windows to provide an alternate QPC |
// implementation that works, but is expensive to use. Certain Athlon CPUs are |
// known to make the QPC implementation unreliable. |
@@ -468,12 +471,12 @@ void InitializeNowFunctionPointers() { |
g_system_trace_now_function = system_trace_now_function; |
} |
-TimeTicks InitialNowFunction() { |
+TimeDelta InitialNowFunction() { |
InitializeNowFunctionPointers(); |
return g_now_function(); |
} |
-TimeTicks InitialSystemTraceNowFunction() { |
+TimeDelta InitialSystemTraceNowFunction() { |
InitializeNowFunctionPointers(); |
return g_system_trace_now_function(); |
} |
@@ -493,7 +496,7 @@ TimeTicks::TickFunctionType TimeTicks::SetMockTickFunction( |
// static |
TimeTicks TimeTicks::Now() { |
- return g_now_function(); |
+ return TimeTicks() + g_now_function(); |
} |
// static |
@@ -504,14 +507,14 @@ bool TimeTicks::IsHighResolution() { |
} |
// static |
-TimeTicks TimeTicks::ThreadNow() { |
+ThreadTicks ThreadTicks::Now() { |
NOTREACHED(); |
- return TimeTicks(); |
+ return ThreadTicks(); |
} |
// static |
-TimeTicks TimeTicks::NowFromSystemTraceTime() { |
- return g_system_trace_now_function(); |
+TraceTicks TraceTicks::Now() { |
+ return TraceTicks() + g_system_trace_now_function(); |
} |
// static |