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

Unified Diff: base/message_pump_mac.mm

Issue 10227001: Simplify ScheduleDelayedWork implementation on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_pump_mac.mm
diff --git a/base/message_pump_mac.mm b/base/message_pump_mac.mm
index e7c422ba6cbde6b523bf0fc5de7d111bec5b0b36..6f0b1b2ac08a7705b2ce91879a57ae4126897619 100644
--- a/base/message_pump_mac.mm
+++ b/base/message_pump_mac.mm
@@ -192,28 +192,8 @@ void MessagePumpCFRunLoopBase::ScheduleWork() {
// Must be called on the run loop thread.
void MessagePumpCFRunLoopBase::ScheduleDelayedWork(
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;
- absolute_work_time.UTCExplode(&exploded);
- double seconds = exploded.second +
- (static_cast<double>((absolute_work_time.ToInternalValue()) %
- Time::kMicrosecondsPerSecond) /
- Time::kMicrosecondsPerSecond);
- CFGregorianDate gregorian = {
- exploded.year,
- exploded.month,
- exploded.day_of_month,
- exploded.hour,
- exploded.minute,
- seconds
- };
- delayed_work_fire_time_ = CFGregorianDateGetAbsoluteTime(gregorian, NULL);
-
+ TimeDelta delta = delayed_work_time - TimeTicks::Now();
+ delayed_work_fire_time_ = CFAbsoluteTimeGetCurrent() + delta.InSecondsF();
CFRunLoopTimerSetNextFireDate(delayed_work_timer_, delayed_work_fire_time_);
}
« 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