| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void DOMTimer::fired() | 101 void DOMTimer::fired() |
| 102 { | 102 { |
| 103 ExecutionContext* context = getExecutionContext(); | 103 ExecutionContext* context = getExecutionContext(); |
| 104 ASSERT(context); | 104 ASSERT(context); |
| 105 context->timers()->setTimerNestingLevel(m_nestingLevel); | 105 context->timers()->setTimerNestingLevel(m_nestingLevel); |
| 106 ASSERT(!context->activeDOMObjectsAreSuspended()); | 106 ASSERT(!context->activeDOMObjectsAreSuspended()); |
| 107 // Only the first execution of a multi-shot timer should get an affirmative
user gesture indicator. | 107 // Only the first execution of a multi-shot timer should get an affirmative
user gesture indicator. |
| 108 UserGestureIndicator gestureIndicator(m_userGestureToken.release()); | 108 UserGestureIndicator gestureIndicator(m_userGestureToken.release()); |
| 109 | 109 |
| 110 TRACE_EVENT1("devtools.timeline", "TimerFire", "data", InspectorTimerFireEve
nt::data(context, m_timeoutID)); | 110 TRACE_EVENT1("devtools.timeline", "TimerFire", "data", InspectorTimerFireEve
nt::data(context, m_timeoutID)); |
| 111 InspectorInstrumentation::allowNativeBreakpoint(context, "timerFired", false
); | 111 InspectorInstrumentationCookie cookie = InspectorInstrumentation::allowNativ
eBreakpoint(context, "timerFired", false); |
| 112 InspectorInstrumentation::AsyncTask asyncTask(context, this); | 112 InspectorInstrumentation::AsyncTask asyncTask(context, this); |
| 113 | 113 |
| 114 // Simple case for non-one-shot timers. | 114 // Simple case for non-one-shot timers. |
| 115 if (isActive()) { | 115 if (isActive()) { |
| 116 if (repeatInterval() && repeatInterval() < minimumInterval) { | 116 if (repeatInterval() && repeatInterval() < minimumInterval) { |
| 117 m_nestingLevel++; | 117 m_nestingLevel++; |
| 118 if (m_nestingLevel >= maxTimerNestingLevel) | 118 if (m_nestingLevel >= maxTimerNestingLevel) |
| 119 augmentRepeatInterval(minimumInterval - repeatInterval()); | 119 augmentRepeatInterval(minimumInterval - repeatInterval()); |
| 120 } | 120 } |
| 121 | 121 |
| 122 // No access to member variables after this point, it can delete the tim
er. | 122 // No access to member variables after this point, it can delete the tim
er. |
| 123 m_action->execute(context); | 123 m_action->execute(context); |
| 124 InspectorInstrumentation::cancelPauseOnNextStatement(cookie); |
| 124 return; | 125 return; |
| 125 } | 126 } |
| 126 | 127 |
| 127 // Unregister the timer from ExecutionContext before executing the action | 128 // Unregister the timer from ExecutionContext before executing the action |
| 128 // for one-shot timers. | 129 // for one-shot timers. |
| 129 ScheduledAction* action = m_action.release(); | 130 ScheduledAction* action = m_action.release(); |
| 130 context->timers()->removeTimeoutByID(m_timeoutID); | 131 context->timers()->removeTimeoutByID(m_timeoutID); |
| 131 | 132 |
| 132 action->execute(context); | 133 action->execute(context); |
| 134 InspectorInstrumentation::cancelPauseOnNextStatement(cookie); |
| 133 | 135 |
| 134 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); | 136 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); |
| 135 | 137 |
| 136 // ExecutionContext might be already gone when we executed action->execute()
. | 138 // ExecutionContext might be already gone when we executed action->execute()
. |
| 137 if (getExecutionContext()) | 139 if (getExecutionContext()) |
| 138 getExecutionContext()->timers()->setTimerNestingLevel(0); | 140 getExecutionContext()->timers()->setTimerNestingLevel(0); |
| 139 } | 141 } |
| 140 | 142 |
| 141 void DOMTimer::stop() | 143 void DOMTimer::stop() |
| 142 { | 144 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 153 return getExecutionContext()->timers()->timerTaskRunner(); | 155 return getExecutionContext()->timers()->timerTaskRunner(); |
| 154 } | 156 } |
| 155 | 157 |
| 156 DEFINE_TRACE(DOMTimer) | 158 DEFINE_TRACE(DOMTimer) |
| 157 { | 159 { |
| 158 visitor->trace(m_action); | 160 visitor->trace(m_action); |
| 159 SuspendableTimer::trace(visitor); | 161 SuspendableTimer::trace(visitor); |
| 160 } | 162 } |
| 161 | 163 |
| 162 } // namespace blink | 164 } // namespace blink |
| OLD | NEW |