Index: base/time_win.cc |
diff --git a/base/time_win.cc b/base/time_win.cc |
index 5d3ecd6772a50e38fb521cba68a4bd076c8efcc3..ca3aef15bebd3d247af712404bb93f02bb5bfa1c 100644 |
--- a/base/time_win.cc |
+++ b/base/time_win.cc |
@@ -310,16 +310,8 @@ TimeDelta RolloverProtectedNow() { |
// retrieve and more reliable. |
class HighResNowSingleton { |
public: |
- HighResNowSingleton() |
- : ticks_per_microsecond_(0.0), |
- skew_(0) { |
- InitializeClock(); |
- |
- // On Athlon X2 CPUs (e.g. model 15) QueryPerformanceCounter is |
- // unreliable. Fallback to low-res clock. |
- base::CPU cpu; |
- if (cpu.vendor_name() == "AuthenticAMD" && cpu.family() == 15) |
- DisableHighResClock(); |
+ static HighResNowSingleton* GetInstance() { |
+ return Singleton<HighResNowSingleton>::get(); |
} |
bool IsUsingHighResClock() { |
@@ -346,6 +338,18 @@ class HighResNowSingleton { |
} |
private: |
+ HighResNowSingleton() |
+ : ticks_per_microsecond_(0.0), |
+ skew_(0) { |
+ InitializeClock(); |
+ |
+ // On Athlon X2 CPUs (e.g. model 15) QueryPerformanceCounter is |
+ // unreliable. Fallback to low-res clock. |
+ base::CPU cpu; |
+ if (cpu.vendor_name() == "AuthenticAMD" && cpu.family() == 15) |
+ DisableHighResClock(); |
+ } |
+ |
// Synchronize the QPC clock with GetSystemTimeAsFileTime. |
void InitializeClock() { |
LARGE_INTEGER ticks_per_sec = {0}; |
@@ -374,7 +378,7 @@ class HighResNowSingleton { |
float ticks_per_microsecond_; // 0 indicates QPF failed and we're broken. |
int64 skew_; // Skew between lo-res and hi-res clocks (for debugging). |
- DISALLOW_COPY_AND_ASSIGN(HighResNowSingleton); |
+ friend struct DefaultSingletonTraits<HighResNowSingleton>; |
}; |
} // namespace |
@@ -394,15 +398,15 @@ TimeTicks TimeTicks::Now() { |
// static |
TimeTicks TimeTicks::HighResNow() { |
- return TimeTicks() + Singleton<HighResNowSingleton>::get()->Now(); |
+ return TimeTicks() + HighResNowSingleton::GetInstance()->Now(); |
} |
// static |
int64 TimeTicks::GetQPCDriftMicroseconds() { |
- return Singleton<HighResNowSingleton>::get()->GetQPCDriftMicroseconds(); |
+ return HighResNowSingleton::GetInstance()->GetQPCDriftMicroseconds(); |
} |
// static |
bool TimeTicks::IsHighResClockWorking() { |
- return Singleton<HighResNowSingleton>::get()->IsUsingHighResClock(); |
+ return HighResNowSingleton::GetInstance()->IsUsingHighResClock(); |
} |