| 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 13 matching lines...) Expand all Loading... |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "platform/ThreadTimers.h" | 28 #include "platform/ThreadTimers.h" |
| 29 | 29 |
| 30 #include "platform/PlatformThreadData.h" | 30 #include "platform/PlatformThreadData.h" |
| 31 #include "platform/SharedTimer.h" | 31 #include "platform/SharedTimer.h" |
| 32 #include "platform/Timer.h" | 32 #include "platform/Timer.h" |
| 33 #include "platform/TraceEvent.h" | 33 #include "platform/TraceEvent.h" |
| 34 #include "platform/heap/AddressSanitizer.h" |
| 34 #include "public/platform/Platform.h" | 35 #include "public/platform/Platform.h" |
| 35 #include "public/platform/WebScheduler.h" | 36 #include "public/platform/WebScheduler.h" |
| 36 #include "wtf/CurrentTime.h" | 37 #include "wtf/CurrentTime.h" |
| 37 #include "wtf/MainThread.h" | 38 #include "wtf/MainThread.h" |
| 38 | 39 |
| 39 namespace blink { | 40 namespace blink { |
| 40 | 41 |
| 41 // Fire timers for this length of time, and then quit to let the run loop proces
s user input events. | 42 // Fire timers for this length of time, and then quit to let the run loop proces
s user input events. |
| 42 // 100ms is about a perceptable delay in UI, so use a half of that as a threshol
d. | 43 // 100ms is about a perceptable delay in UI, so use a half of that as a threshol
d. |
| 43 // This is to prevent UI freeze when there are too many timers or machine perfor
mance is low. | 44 // This is to prevent UI freeze when there are too many timers or machine perfor
mance is low. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 71 } | 72 } |
| 72 | 73 |
| 73 m_sharedTimer = sharedTimer; | 74 m_sharedTimer = sharedTimer; |
| 74 | 75 |
| 75 if (m_sharedTimer) { | 76 if (m_sharedTimer) { |
| 76 m_sharedTimer->setFiredFunction(ThreadTimers::sharedTimerFired); | 77 m_sharedTimer->setFiredFunction(ThreadTimers::sharedTimerFired); |
| 77 updateSharedTimer(); | 78 updateSharedTimer(); |
| 78 } | 79 } |
| 79 } | 80 } |
| 80 | 81 |
| 82 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
| 81 void ThreadTimers::updateSharedTimer() | 83 void ThreadTimers::updateSharedTimer() |
| 82 { | 84 { |
| 83 if (!m_sharedTimer) | 85 if (!m_sharedTimer) |
| 84 return; | 86 return; |
| 85 | 87 |
| 86 if (m_firingTimers || m_timerHeap.isEmpty()) { | 88 if (m_firingTimers || m_timerHeap.isEmpty()) { |
| 87 m_pendingSharedTimerFireTime = 0; | 89 m_pendingSharedTimerFireTime = 0; |
| 88 m_sharedTimer->stop(); | 90 m_sharedTimer->stop(); |
| 89 } else { | 91 } else { |
| 90 double nextFireTime = m_timerHeap.first()->m_nextFireTime; | 92 double nextFireTime = m_timerHeap.first()->m_nextFireTime; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 || (isMainThread() && Platform::current()->currentThread()->schedule
r()->shouldYieldForHighPriorityWork())) | 143 || (isMainThread() && Platform::current()->currentThread()->schedule
r()->shouldYieldForHighPriorityWork())) |
| 142 break; | 144 break; |
| 143 } | 145 } |
| 144 | 146 |
| 145 m_firingTimers = false; | 147 m_firingTimers = false; |
| 146 | 148 |
| 147 updateSharedTimer(); | 149 updateSharedTimer(); |
| 148 } | 150 } |
| 149 | 151 |
| 150 } // namespace blink | 152 } // namespace blink |
| 151 | |
| OLD | NEW |