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

Side by Side Diff: Source/platform/Timer.cpp

Issue 1303153005: Introduce WebTaskRunner Patch 3/5 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add missing #include Created 5 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
« no previous file with comments | « Source/platform/Timer.h ('k') | Source/platform/TimerTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // If the timer is being aligned, use postTimerTaskAt() to schedule it 103 // If the timer is being aligned, use postTimerTaskAt() to schedule it
104 // so that the relative order of aligned timers is preserved. 104 // so that the relative order of aligned timers is preserved.
105 // TODO(skyostil): Move timer alignment into the scheduler. 105 // TODO(skyostil): Move timer alignment into the scheduler.
106 m_webScheduler->postTimerTaskAt(m_location, m_cancellableTimerTask, m_nextFireTime); 106 m_webScheduler->postTimerTaskAt(m_location, m_cancellableTimerTask, m_nextFireTime);
107 } else { 107 } else {
108 // Round the delay up to the nearest millisecond to be consistant wi th the 108 // Round the delay up to the nearest millisecond to be consistant wi th the
109 // previous behavior of BlinkPlatformImpl::setSharedTimerFireInterva l. 109 // previous behavior of BlinkPlatformImpl::setSharedTimerFireInterva l.
110 long long delayMs = static_cast<long long>(ceil((newTime - now) * 10 00.0)); 110 long long delayMs = static_cast<long long>(ceil((newTime - now) * 10 00.0));
111 if (delayMs < 0) 111 if (delayMs < 0)
112 delayMs = 0; 112 delayMs = 0;
113 m_webScheduler->postTimerTask(m_location, m_cancellableTimerTask, de layMs); 113 m_webScheduler->timerTaskRunner()->postDelayedTask(m_location, m_can cellableTimerTask, delayMs);
114 } 114 }
115 } 115 }
116 } 116 }
117 117
118 NO_LAZY_SWEEP_SANITIZE_ADDRESS 118 NO_LAZY_SWEEP_SANITIZE_ADDRESS
119 void TimerBase::runInternal() 119 void TimerBase::runInternal()
120 { 120 {
121 if (!canFire()) 121 if (!canFire())
122 return; 122 return;
123 123
(...skipping 20 matching lines...) Expand all
144 ASSERT(isActive()); 144 ASSERT(isActive());
145 return std::max(m_unalignedNextFireTime - monotonicallyIncreasingTime(), 0.0 ); 145 return std::max(m_unalignedNextFireTime - monotonicallyIncreasingTime(), 0.0 );
146 } 146 }
147 147
148 bool TimerBase::Comparator::operator()(const TimerBase* a, const TimerBase* b) c onst 148 bool TimerBase::Comparator::operator()(const TimerBase* a, const TimerBase* b) c onst
149 { 149 {
150 return a->m_unalignedNextFireTime < b->m_unalignedNextFireTime; 150 return a->m_unalignedNextFireTime < b->m_unalignedNextFireTime;
151 } 151 }
152 152
153 } // namespace blink 153 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/Timer.h ('k') | Source/platform/TimerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698