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

Unified Diff: trunk/src/base/time/time_win.cc

Issue 22984005: Revert 217172 "Enable high resolution time for TimeTicks::Now on..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/src/base/time/time.h ('k') | trunk/src/chrome/browser/chrome_browser_main_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/base/time/time_win.cc
===================================================================
--- trunk/src/base/time/time_win.cc (revision 217225)
+++ trunk/src/base/time/time_win.cc (working copy)
@@ -322,12 +322,6 @@
return TimeDelta::FromMilliseconds(now + rollover_ms);
}
-bool IsBuggyAthlon(const base::CPU& cpu) {
- // On Athlon X2 CPUs (e.g. model 15) QueryPerformanceCounter is
- // unreliable. Fallback to low-res clock.
- return cpu.vendor_name() == "AuthenticAMD" && cpu.family() == 15;
-}
-
// Overview of time counters:
// (1) CPU cycle counter. (Retrieved via RDTSC)
// The CPU counter provides the highest resolution time stamp and is the least
@@ -404,8 +398,10 @@
skew_(0) {
InitializeClock();
+ // On Athlon X2 CPUs (e.g. model 15) QueryPerformanceCounter is
+ // unreliable. Fallback to low-res clock.
base::CPU cpu;
- if (IsBuggyAthlon(cpu))
+ if (cpu.vendor_name() == "AuthenticAMD" && cpu.family() == 15)
DisableHighResClock();
}
@@ -437,24 +433,6 @@
friend struct DefaultSingletonTraits<HighResNowSingleton>;
};
-TimeDelta HighResNowWrapper() {
- return HighResNowSingleton::GetInstance()->Now();
-}
-
-typedef TimeDelta (*NowFunction)(void);
-NowFunction now_function = RolloverProtectedNow;
-
-bool CPUReliablySupportsHighResTime() {
- base::CPU cpu;
- if (!cpu.has_non_stop_time_stamp_counter())
- return false;
-
- if (IsBuggyAthlon(cpu))
- return false;
-
- return true;
-}
-
} // namespace
// static
@@ -469,18 +447,8 @@
}
// static
-bool TimeTicks::SetNowIsHighResNowIfSupported() {
- if (!CPUReliablySupportsHighResTime()) {
- return false;
- }
-
- now_function = HighResNowWrapper;
- return true;
-}
-
-// static
TimeTicks TimeTicks::Now() {
- return TimeTicks() + now_function();
+ return TimeTicks() + RolloverProtectedNow();
}
// static
@@ -515,14 +483,6 @@
return HighResNowSingleton::GetInstance()->IsUsingHighResClock();
}
-TimeTicks TimeTicks::UnprotectedNow() {
- if (now_function == HighResNowWrapper) {
- return Now();
- } else {
- return TimeTicks() + TimeDelta::FromMilliseconds(timeGetTime());
- }
-}
-
// TimeDelta ------------------------------------------------------------------
// static
« no previous file with comments | « trunk/src/base/time/time.h ('k') | trunk/src/chrome/browser/chrome_browser_main_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698