| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 DOMTimer::DOMTimer(ExecutionContext* context, PassOwnPtr<ScheduledAction> action
, int interval, bool singleShot, int timeoutID) | 92 DOMTimer::DOMTimer(ExecutionContext* context, PassOwnPtr<ScheduledAction> action
, int interval, bool singleShot, int timeoutID) |
| 93 : SuspendableTimer(context) | 93 : SuspendableTimer(context) |
| 94 , m_timeoutID(timeoutID) | 94 , m_timeoutID(timeoutID) |
| 95 , m_nestingLevel(timerNestingLevel + 1) | 95 , m_nestingLevel(timerNestingLevel + 1) |
| 96 , m_action(action) | 96 , m_action(action) |
| 97 { | 97 { |
| 98 ASSERT(timeoutID > 0); | 98 ASSERT(timeoutID > 0); |
| 99 if (shouldForwardUserGesture(interval, m_nestingLevel)) | 99 if (shouldForwardUserGesture(interval, m_nestingLevel)) |
| 100 m_userGestureToken = UserGestureIndicator::currentToken(); | 100 m_userGestureToken = UserGestureIndicator::currentToken(); |
| 101 | 101 |
| 102 double intervalMilliseconds = std::max(oneMillisecond, interval * oneMillise
cond); | 102 double intervalMilliseconds = std::max(0.0, interval * oneMillisecond); |
| 103 if (intervalMilliseconds < minimumInterval && m_nestingLevel >= maxTimerNest
ingLevel) | 103 if (intervalMilliseconds < minimumInterval && m_nestingLevel >= maxTimerNest
ingLevel) |
| 104 intervalMilliseconds = minimumInterval; | 104 intervalMilliseconds = minimumInterval; |
| 105 if (singleShot) | 105 if (singleShot) |
| 106 startOneShot(intervalMilliseconds, FROM_HERE); | 106 startOneShot(intervalMilliseconds, FROM_HERE); |
| 107 else | 107 else |
| 108 startRepeating(intervalMilliseconds, FROM_HERE); | 108 startRepeating(intervalMilliseconds, FROM_HERE); |
| 109 } | 109 } |
| 110 | 110 |
| 111 DOMTimer::~DOMTimer() | 111 DOMTimer::~DOMTimer() |
| 112 { | 112 { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 if (fireTime - alignedTimeRoundedDown < minimumInterval) | 207 if (fireTime - alignedTimeRoundedDown < minimumInterval) |
| 208 return alignedTimeRoundedDown; | 208 return alignedTimeRoundedDown; |
| 209 | 209 |
| 210 return alignedTimeRoundedUp; | 210 return alignedTimeRoundedUp; |
| 211 } | 211 } |
| 212 | 212 |
| 213 return fireTime; | 213 return fireTime; |
| 214 } | 214 } |
| 215 | 215 |
| 216 } // namespace blink | 216 } // namespace blink |
| OLD | NEW |