Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 m_nestingLevel(context->timers()->timerNestingLevel() + 1), | 86 m_nestingLevel(context->timers()->timerNestingLevel() + 1), |
| 87 m_action(action) { | 87 m_action(action) { |
| 88 ASSERT(timeoutID > 0); | 88 ASSERT(timeoutID > 0); |
| 89 if (shouldForwardUserGesture(interval, m_nestingLevel)) { | 89 if (shouldForwardUserGesture(interval, m_nestingLevel)) { |
| 90 // Thread safe because shouldForwardUserGesture will only return true if | 90 // Thread safe because shouldForwardUserGesture will only return true if |
| 91 // execution is on the the main thread. | 91 // execution is on the the main thread. |
| 92 m_userGestureToken = UserGestureIndicator::currentToken(); | 92 m_userGestureToken = UserGestureIndicator::currentToken(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 double intervalMilliseconds = | 95 double intervalMilliseconds = |
| 96 std::max(oneMillisecond, interval * oneMillisecond); | 96 std::max(singleShot ? 0.0 : oneMillisecond, interval * oneMillisecond); |
|
Sami
2017/03/08 14:15:55
Did we try to make the minimum always be 0 for all
| |
| 97 if (intervalMilliseconds < minimumInterval && | 97 if (intervalMilliseconds < minimumInterval && |
| 98 m_nestingLevel >= maxTimerNestingLevel) | 98 m_nestingLevel >= maxTimerNestingLevel) |
| 99 intervalMilliseconds = minimumInterval; | 99 intervalMilliseconds = minimumInterval; |
| 100 if (singleShot) | 100 if (singleShot) |
| 101 startOneShot(intervalMilliseconds, BLINK_FROM_HERE); | 101 startOneShot(intervalMilliseconds, BLINK_FROM_HERE); |
| 102 else | 102 else |
| 103 startRepeating(intervalMilliseconds, BLINK_FROM_HERE); | 103 startRepeating(intervalMilliseconds, BLINK_FROM_HERE); |
| 104 | 104 |
| 105 suspendIfNeeded(); | 105 suspendIfNeeded(); |
| 106 probe::asyncTaskScheduledBreakable( | 106 probe::asyncTaskScheduledBreakable( |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 RefPtr<WebTaskRunner> DOMTimer::timerTaskRunner() const { | 189 RefPtr<WebTaskRunner> DOMTimer::timerTaskRunner() const { |
| 190 return getExecutionContext()->timers()->timerTaskRunner(); | 190 return getExecutionContext()->timers()->timerTaskRunner(); |
| 191 } | 191 } |
| 192 | 192 |
| 193 DEFINE_TRACE(DOMTimer) { | 193 DEFINE_TRACE(DOMTimer) { |
| 194 visitor->trace(m_action); | 194 visitor->trace(m_action); |
| 195 SuspendableTimer::trace(visitor); | 195 SuspendableTimer::trace(visitor); |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace blink | 198 } // namespace blink |
| OLD | NEW |