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

Unified Diff: base/message_pump_mac.mm

Issue 3884001: Switch to using TimeTicks rather than Time in message loops (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | « base/message_pump_mac.h ('k') | base/message_pump_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_pump_mac.mm
===================================================================
--- base/message_pump_mac.mm (revision 65315)
+++ base/message_pump_mac.mm (working copy)
@@ -225,11 +225,17 @@
// Must be called on the run loop thread.
void MessagePumpCFRunLoopBase::ScheduleDelayedWork(
- const Time& delayed_work_time) {
+ const TimeTicks& delayed_work_time) {
+ // TODO(jar): We may need a more efficient way to go between these times, but
+ // the difference will change not only when we sleep/wake, it will also change
+ // when the user changes the wall clock time :-/.
+ Time absolute_work_time =
+ (delayed_work_time - TimeTicks::Now()) + Time::Now();
+
Time::Exploded exploded;
- delayed_work_time.UTCExplode(&exploded);
+ absolute_work_time.UTCExplode(&exploded);
double seconds = exploded.second +
- (static_cast<double>((delayed_work_time.ToInternalValue()) %
+ (static_cast<double>((absolute_work_time.ToInternalValue()) %
Time::kMicrosecondsPerSecond) /
Time::kMicrosecondsPerSecond);
CFGregorianDate gregorian = {
@@ -320,12 +326,12 @@
// released promptly even in the absence of UI events.
MessagePumpScopedAutoreleasePool autorelease_pool(this);
- Time next_time;
+ TimeTicks next_time;
delegate_->DoDelayedWork(&next_time);
bool more_work = !next_time.is_null();
if (more_work) {
- TimeDelta delay = next_time - Time::Now();
+ TimeDelta delay = next_time - TimeTicks::Now();
if (delay > TimeDelta()) {
// There's more delayed work to be done in the future.
ScheduleDelayedWork(next_time);
« no previous file with comments | « base/message_pump_mac.h ('k') | base/message_pump_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698