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

Side by Side Diff: base/time/time_win.cc

Issue 415783004: crank timeBeginPeriod to 4ms (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 high_resolution_timer_enabled_ = enable; 175 high_resolution_timer_enabled_ = enable;
176 } 176 }
177 177
178 // static 178 // static
179 bool Time::ActivateHighResolutionTimer(bool activating) { 179 bool Time::ActivateHighResolutionTimer(bool activating) {
180 if (!high_resolution_timer_enabled_ && activating) 180 if (!high_resolution_timer_enabled_ && activating)
181 return false; 181 return false;
182 182
183 // Using anything other than 1ms makes timers granular 183 // Using anything other than 1ms makes timers granular
184 // to that interval. 184 // to that interval.
185 const int kMinTimerIntervalMs = 1; 185 const int kMinTimerIntervalMs = 4;
186 MMRESULT result; 186 MMRESULT result;
187 if (activating) { 187 if (activating) {
188 result = timeBeginPeriod(kMinTimerIntervalMs); 188 result = timeBeginPeriod(kMinTimerIntervalMs);
189 high_resolution_timer_activated_++; 189 high_resolution_timer_activated_++;
190 } else { 190 } else {
191 result = timeEndPeriod(kMinTimerIntervalMs); 191 result = timeEndPeriod(kMinTimerIntervalMs);
192 high_resolution_timer_activated_--; 192 high_resolution_timer_activated_--;
193 } 193 }
194 return result == TIMERR_NOERROR; 194 return result == TIMERR_NOERROR;
195 } 195 }
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 return TimeTicks() + TimeDelta::FromMilliseconds(timeGetTime()); 527 return TimeTicks() + TimeDelta::FromMilliseconds(timeGetTime());
528 } 528 }
529 } 529 }
530 530
531 // TimeDelta ------------------------------------------------------------------ 531 // TimeDelta ------------------------------------------------------------------
532 532
533 // static 533 // static
534 TimeDelta TimeDelta::FromQPCValue(LONGLONG qpc_value) { 534 TimeDelta TimeDelta::FromQPCValue(LONGLONG qpc_value) {
535 return TimeDelta(GetHighResNowSingleton()->QPCValueToMicroseconds(qpc_value)); 535 return TimeDelta(GetHighResNowSingleton()->QPCValueToMicroseconds(qpc_value));
536 } 536 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698