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

Side by Side Diff: base/time_win.cc

Issue 7910002: Switch on use of precompiled headers for VS 2008. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up comments++ Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « DEPS ('k') | build/win_precompile.gypi » ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 5
6 // Windows Timer Primer 6 // Windows Timer Primer
7 // 7 //
8 // A good article: http://www.ddj.com/windows/184416651 8 // A good article: http://www.ddj.com/windows/184416651
9 // A good mozilla bug: http://bugzilla.mozilla.org/show_bug.cgi?id=363258 9 // A good mozilla bug: http://bugzilla.mozilla.org/show_bug.cgi?id=363258
10 // 10 //
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 return TimeDelta::FromMicroseconds(UnreliableNow()); 356 return TimeDelta::FromMicroseconds(UnreliableNow());
357 357
358 // Just fallback to the slower clock. 358 // Just fallback to the slower clock.
359 return RolloverProtectedNow(); 359 return RolloverProtectedNow();
360 } 360 }
361 361
362 int64 GetQPCDriftMicroseconds() { 362 int64 GetQPCDriftMicroseconds() {
363 if (!IsUsingHighResClock()) 363 if (!IsUsingHighResClock())
364 return 0; 364 return 0;
365 365
366 #if defined(OS_WIN)
367 // The static_cast<long> is needed as a hint to VS 2008 to tell it
368 // which version of abs() to use. Other compilers don't seem to
369 // need it, including VS 2010, but to keep code identical between
370 // VS 2008 and 2010 we use the hint for all Windows builds.
371 return abs(static_cast<long>((UnreliableNow() - ReliableNow()) - skew_));
brettw 2011/09/15 18:03:15 Is it possible to use this on all platforms and sk
372 #else
366 return abs((UnreliableNow() - ReliableNow()) - skew_); 373 return abs((UnreliableNow() - ReliableNow()) - skew_);
374 #endif
367 } 375 }
368 376
369 private: 377 private:
370 HighResNowSingleton() 378 HighResNowSingleton()
371 : ticks_per_microsecond_(0.0), 379 : ticks_per_microsecond_(0.0),
372 skew_(0) { 380 skew_(0) {
373 InitializeClock(); 381 InitializeClock();
374 382
375 // On Athlon X2 CPUs (e.g. model 15) QueryPerformanceCounter is 383 // On Athlon X2 CPUs (e.g. model 15) QueryPerformanceCounter is
376 // unreliable. Fallback to low-res clock. 384 // unreliable. Fallback to low-res clock.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 440
433 // static 441 // static
434 int64 TimeTicks::GetQPCDriftMicroseconds() { 442 int64 TimeTicks::GetQPCDriftMicroseconds() {
435 return HighResNowSingleton::GetInstance()->GetQPCDriftMicroseconds(); 443 return HighResNowSingleton::GetInstance()->GetQPCDriftMicroseconds();
436 } 444 }
437 445
438 // static 446 // static
439 bool TimeTicks::IsHighResClockWorking() { 447 bool TimeTicks::IsHighResClockWorking() {
440 return HighResNowSingleton::GetInstance()->IsUsingHighResClock(); 448 return HighResNowSingleton::GetInstance()->IsUsingHighResClock();
441 } 449 }
OLDNEW
« no previous file with comments | « DEPS ('k') | build/win_precompile.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698