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

Side by Side Diff: base/time_win.cc

Issue 7977003: Relanding precompiled header support for VS 2008, now enabled for (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modify how PCH is turned off for mini_installer. 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 | « no previous file | build/win_precompile.gypi » ('j') | build/win_precompile.gypi » ('J')
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 return abs((UnreliableNow() - ReliableNow()) - skew_); 366 // The static_cast<long> is needed as a hint to VS 2008 to tell it
367 // which version of abs() to use. Other compilers don't seem to
368 // need it, including VS 2010, but to keep code identical we use it
369 // everywhere.
370 // TODO(joi): Remove the hint if/when we no longer support VS 2008.
371 return abs(static_cast<long>((UnreliableNow() - ReliableNow()) - skew_));
367 } 372 }
368 373
369 private: 374 private:
370 HighResNowSingleton() 375 HighResNowSingleton()
371 : ticks_per_microsecond_(0.0), 376 : ticks_per_microsecond_(0.0),
372 skew_(0) { 377 skew_(0) {
373 InitializeClock(); 378 InitializeClock();
374 379
375 // On Athlon X2 CPUs (e.g. model 15) QueryPerformanceCounter is 380 // On Athlon X2 CPUs (e.g. model 15) QueryPerformanceCounter is
376 // unreliable. Fallback to low-res clock. 381 // unreliable. Fallback to low-res clock.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 437
433 // static 438 // static
434 int64 TimeTicks::GetQPCDriftMicroseconds() { 439 int64 TimeTicks::GetQPCDriftMicroseconds() {
435 return HighResNowSingleton::GetInstance()->GetQPCDriftMicroseconds(); 440 return HighResNowSingleton::GetInstance()->GetQPCDriftMicroseconds();
436 } 441 }
437 442
438 // static 443 // static
439 bool TimeTicks::IsHighResClockWorking() { 444 bool TimeTicks::IsHighResClockWorking() {
440 return HighResNowSingleton::GetInstance()->IsUsingHighResClock(); 445 return HighResNowSingleton::GetInstance()->IsUsingHighResClock();
441 } 446 }
OLDNEW
« no previous file with comments | « no previous file | build/win_precompile.gypi » ('j') | build/win_precompile.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698