| OLD | NEW |
| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 111 } |
| 112 | 112 |
| 113 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 113 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
| 114 void TimerBase::runInternal() | 114 void TimerBase::runInternal() |
| 115 { | 115 { |
| 116 if (!canFire()) | 116 if (!canFire()) |
| 117 return; | 117 return; |
| 118 | 118 |
| 119 TRACE_EVENT0("blink", "TimerBase::run"); | 119 TRACE_EVENT0("blink", "TimerBase::run"); |
| 120 #if DCHECK_IS_ON() | 120 #if DCHECK_IS_ON() |
| 121 DCHECK_EQ(m_thread, currentThread()) << "Timer posted by " << m_location.fun
ction_name() << " " << m_location.file_name() << " was run on a different thread
"; | 121 DCHECK_EQ(m_thread, currentThread()) << "Timer posted by " << m_location.fun
ctionName() << " " << m_location.fileName() << " was run on a different thread"; |
| 122 #endif | 122 #endif |
| 123 TRACE_EVENT_SET_SAMPLING_STATE("blink", "BlinkInternal"); | 123 TRACE_EVENT_SET_SAMPLING_STATE("blink", "BlinkInternal"); |
| 124 | 124 |
| 125 if (m_repeatInterval) { | 125 if (m_repeatInterval) { |
| 126 double now = timerMonotonicallyIncreasingTime(); | 126 double now = timerMonotonicallyIncreasingTime(); |
| 127 // This computation should be drift free, and it will cope if we miss a
beat, | 127 // This computation should be drift free, and it will cope if we miss a
beat, |
| 128 // which can easily happen if the thread is busy. It will also cope if
we get | 128 // which can easily happen if the thread is busy. It will also cope if
we get |
| 129 // called slightly before m_unalignedNextFireTime, which can happen due
to lack | 129 // called slightly before m_unalignedNextFireTime, which can happen due
to lack |
| 130 // of timer precision. | 130 // of timer precision. |
| 131 double intervalToNextFireTime = m_repeatInterval - fmod(now - m_nextFire
Time, m_repeatInterval); | 131 double intervalToNextFireTime = m_repeatInterval - fmod(now - m_nextFire
Time, m_repeatInterval); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 147 { | 147 { |
| 148 return Platform::current()->currentThread()->getWebTaskRunner(); | 148 return Platform::current()->currentThread()->getWebTaskRunner(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 double TimerBase::timerMonotonicallyIncreasingTime() const | 151 double TimerBase::timerMonotonicallyIncreasingTime() const |
| 152 { | 152 { |
| 153 return timerTaskRunner()->monotonicallyIncreasingVirtualTimeSeconds(); | 153 return timerTaskRunner()->monotonicallyIncreasingVirtualTimeSeconds(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace blink | 156 } // namespace blink |
| OLD | NEW |