| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 startOneShot(intervalMilliseconds, BLINK_FROM_HERE); | 97 startOneShot(intervalMilliseconds, BLINK_FROM_HERE); |
| 98 else | 98 else |
| 99 startRepeating(intervalMilliseconds, BLINK_FROM_HERE); | 99 startRepeating(intervalMilliseconds, BLINK_FROM_HERE); |
| 100 | 100 |
| 101 suspendIfNeeded(); | 101 suspendIfNeeded(); |
| 102 TRACE_EVENT_INSTANT1("devtools.timeline", "TimerInstall", | 102 TRACE_EVENT_INSTANT1("devtools.timeline", "TimerInstall", |
| 103 TRACE_EVENT_SCOPE_THREAD, "data", | 103 TRACE_EVENT_SCOPE_THREAD, "data", |
| 104 InspectorTimerInstallEvent::data(context, timeoutID, | 104 InspectorTimerInstallEvent::data(context, timeoutID, |
| 105 interval, singleShot)); | 105 interval, singleShot)); |
| 106 probe::asyncTaskScheduledBreakable( | 106 probe::asyncTaskScheduledBreakable( |
| 107 context, singleShot ? "setTimeout" : "setInterval", this, !singleShot); | 107 context, singleShot ? "setTimeout" : "setInterval", this); |
| 108 } | 108 } |
| 109 | 109 |
| 110 DOMTimer::~DOMTimer() { | 110 DOMTimer::~DOMTimer() { |
| 111 if (m_action) | 111 if (m_action) |
| 112 m_action->dispose(); | 112 m_action->dispose(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void DOMTimer::stop() { | 115 void DOMTimer::stop() { |
| 116 probe::asyncTaskCanceledBreakable( | 116 probe::asyncTaskCanceledBreakable( |
| 117 getExecutionContext(), | 117 getExecutionContext(), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 138 DCHECK(!context->isContextSuspended()); | 138 DCHECK(!context->isContextSuspended()); |
| 139 // Only the first execution of a multi-shot timer should get an affirmative | 139 // Only the first execution of a multi-shot timer should get an affirmative |
| 140 // user gesture indicator. | 140 // user gesture indicator. |
| 141 UserGestureIndicator gestureIndicator(std::move(m_userGestureToken)); | 141 UserGestureIndicator gestureIndicator(std::move(m_userGestureToken)); |
| 142 | 142 |
| 143 TRACE_EVENT1("devtools.timeline", "TimerFire", "data", | 143 TRACE_EVENT1("devtools.timeline", "TimerFire", "data", |
| 144 InspectorTimerFireEvent::data(context, m_timeoutID)); | 144 InspectorTimerFireEvent::data(context, m_timeoutID)); |
| 145 probe::UserCallback probe(context, | 145 probe::UserCallback probe(context, |
| 146 repeatInterval() ? "setInterval" : "setTimeout", | 146 repeatInterval() ? "setInterval" : "setTimeout", |
| 147 AtomicString(), true); | 147 AtomicString(), true); |
| 148 probe::AsyncTask asyncTask(context, this); | 148 probe::AsyncTask asyncTask(context, this, |
| 149 repeatInterval() ? "fired" : nullptr); |
| 149 | 150 |
| 150 // Simple case for non-one-shot timers. | 151 // Simple case for non-one-shot timers. |
| 151 if (isActive()) { | 152 if (isActive()) { |
| 152 if (repeatInterval() && repeatInterval() < minimumInterval) { | 153 if (repeatInterval() && repeatInterval() < minimumInterval) { |
| 153 m_nestingLevel++; | 154 m_nestingLevel++; |
| 154 if (m_nestingLevel >= maxTimerNestingLevel) | 155 if (m_nestingLevel >= maxTimerNestingLevel) |
| 155 augmentRepeatInterval(minimumInterval - repeatInterval()); | 156 augmentRepeatInterval(minimumInterval - repeatInterval()); |
| 156 } | 157 } |
| 157 | 158 |
| 158 // No access to member variables after this point, it can delete the timer. | 159 // No access to member variables after this point, it can delete the timer. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 185 RefPtr<WebTaskRunner> DOMTimer::timerTaskRunner() const { | 186 RefPtr<WebTaskRunner> DOMTimer::timerTaskRunner() const { |
| 186 return getExecutionContext()->timers()->timerTaskRunner(); | 187 return getExecutionContext()->timers()->timerTaskRunner(); |
| 187 } | 188 } |
| 188 | 189 |
| 189 DEFINE_TRACE(DOMTimer) { | 190 DEFINE_TRACE(DOMTimer) { |
| 190 visitor->trace(m_action); | 191 visitor->trace(m_action); |
| 191 SuspendableTimer::trace(visitor); | 192 SuspendableTimer::trace(visitor); |
| 192 } | 193 } |
| 193 | 194 |
| 194 } // namespace blink | 195 } // namespace blink |
| OLD | NEW |