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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 InspectorInstrumentation::AsyncTask asyncTask(context, this); | 150 InspectorInstrumentation::AsyncTask asyncTask(context, this); |
| 151 | 151 |
| 152 // Simple case for non-one-shot timers. | 152 // Simple case for non-one-shot timers. |
| 153 if (isActive()) { | 153 if (isActive()) { |
| 154 if (repeatInterval() && repeatInterval() < minimumInterval) { | 154 if (repeatInterval() && repeatInterval() < minimumInterval) { |
| 155 m_nestingLevel++; | 155 m_nestingLevel++; |
| 156 if (m_nestingLevel >= maxTimerNestingLevel) | 156 if (m_nestingLevel >= maxTimerNestingLevel) |
| 157 augmentRepeatInterval(minimumInterval - repeatInterval()); | 157 augmentRepeatInterval(minimumInterval - repeatInterval()); |
| 158 } | 158 } |
| 159 | 159 |
| 160 // Get ExecutionContext early as it might be cleared during | |
| 161 // action->execute(). | |
| 162 ExecutionContext* executionContext = getExecutionContext(); | |
| 163 | |
| 160 // No access to member variables after this point, it can delete the timer. | 164 // No access to member variables after this point, it can delete the timer. |
| 161 m_action->execute(context); | 165 m_action->execute(context); |
| 166 | |
| 167 if (!executionContext) | |
|
jochen (gone - plz use gerrit)
2017/02/15 10:35:12
I don't think that's possible?
Dan Elphick
2017/02/15 14:03:32
You're probably right - I was just playing it safe
| |
| 168 return; | |
| 169 | |
| 170 executionContext->timers()->setTimerNestingLevel(0); | |
| 171 | |
| 162 return; | 172 return; |
| 163 } | 173 } |
| 164 | 174 |
| 165 // Unregister the timer from ExecutionContext before executing the action | 175 // Unregister the timer from ExecutionContext before executing the action |
| 166 // for one-shot timers. | 176 // for one-shot timers. |
| 167 ScheduledAction* action = m_action.release(); | 177 ScheduledAction* action = m_action.release(); |
| 168 context->timers()->removeTimeoutByID(m_timeoutID); | 178 context->timers()->removeTimeoutByID(m_timeoutID); |
| 169 | 179 |
| 170 action->execute(context); | 180 action->execute(context); |
| 171 | 181 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 188 RefPtr<WebTaskRunner> DOMTimer::timerTaskRunner() const { | 198 RefPtr<WebTaskRunner> DOMTimer::timerTaskRunner() const { |
| 189 return getExecutionContext()->timers()->timerTaskRunner(); | 199 return getExecutionContext()->timers()->timerTaskRunner(); |
| 190 } | 200 } |
| 191 | 201 |
| 192 DEFINE_TRACE(DOMTimer) { | 202 DEFINE_TRACE(DOMTimer) { |
| 193 visitor->trace(m_action); | 203 visitor->trace(m_action); |
| 194 SuspendableTimer::trace(visitor); | 204 SuspendableTimer::trace(visitor); |
| 195 } | 205 } |
| 196 | 206 |
| 197 } // namespace blink | 207 } // namespace blink |
| OLD | NEW |