void DOMTimer::fired() { ExecutionContext* context = getExecutionContext(); ASSERT(context); context->timers()->setTimerNestingLevel(m_nestingLevel); ASSERT(!context->activeDOMObjectsAreSuspended()); // Only the first execution of a multi-shot timer should get an affirmative user gesture indicator. UserGestureIndicator gestureIndicator(m_userGestureToken.release()); TRACE_EVENT1("devtools.timeline", "TimerFire", "data", InspectorTimerFireEvent::data(context, m_timeoutID)); InspectorInstrumentation::NativeBreakpoint nativeBreakpoint(context, "timerFired", false); InspectorInstrumentation::AsyncTask asyncTask(context, this); // Simple case for non-one-shot timers. if (isActive()) { if (repeatInterval() && repeatInterval() < minimumInterval) { m_nestingLevel++; if (m_nestingLevel >= maxTimerNestingLevel) augmentRepeatInterval(minimumInterval - repeatInterval()); } // No access to member variables after this point, it can delete the timer. m_action->execute(context); return; } // Unregister the timer from ExecutionContext before executing the action // for one-shot timers. ScheduledAction* action = m_action.release(); context->timers()->removeTimeoutByID(m_timeoutID); action->execute(context); TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data()); // ExecutionContext might be already gone when we executed action->execute(). ExecutionContext* executionContext = getExecutionContext(); if (!executionContext) return; executionContext->timers()->setTimerNestingLevel(0); // Eagerly unregister as ExecutionContext observer. clearContext(); }
void DOMTimer::fired() { ScriptExecutionContext* context = scriptExecutionContext(); timerNestingLevel = m_nestingLevel; #if ENABLE(INSPECTOR) InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context); if (timelineAgent) timelineAgent->willFireTimer(m_timeoutId); #endif // Simple case for non-one-shot timers. if (isActive()) { if (repeatInterval() && repeatInterval() < s_minTimerInterval) { m_nestingLevel++; if (m_nestingLevel >= maxTimerNestingLevel) augmentRepeatInterval(s_minTimerInterval - repeatInterval()); } // No access to member variables after this point, it can delete the timer. m_action->execute(context); #if ENABLE(INSPECTOR) if (timelineAgent) timelineAgent->didFireTimer(); #endif return; } // Delete timer before executing the action for one-shot timers. ScheduledAction* action = m_action.release(); // No access to member variables after this point. delete this; action->execute(context); #if ENABLE(INSPECTOR) if (timelineAgent) timelineAgent->didFireTimer(); #endif delete action; timerNestingLevel = 0; }
void DOMTimer::fired() { ExecutionContext* context = executionContext(); timerNestingLevel = m_nestingLevel; ASSERT(!context->activeDOMObjectsAreSuspended()); // Only the first execution of a multi-shot timer should get an affirmative user gesture indicator. UserGestureIndicator gestureIndicator(m_userGestureToken.release()); TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimerFire", "data", InspectorTimerFireEvent::data(context, m_timeoutID)); // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeline migrates to tracing. InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutID); // Simple case for non-one-shot timers. if (isActive()) { if (repeatInterval() && repeatInterval() < minimumInterval) { m_nestingLevel++; if (m_nestingLevel >= maxTimerNestingLevel) augmentRepeatInterval(minimumInterval - repeatInterval()); } // No access to member variables after this point, it can delete the timer. m_action->execute(context); InspectorInstrumentation::didFireTimer(cookie); return; } // Delete timer before executing the action for one-shot timers. OwnPtr<ScheduledAction> action = m_action.release(); // This timer is being deleted; no access to member variables allowed after this point. context->removeTimeoutByID(m_timeoutID); action->execute(context); InspectorInstrumentation::didFireTimer(cookie); TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", "data", InspectorUpdateCountersEvent::data()); timerNestingLevel = 0; }
void DOMTimer::fired() { ScriptExecutionContext* context = scriptExecutionContext(); timerNestingLevel = m_nestingLevel; UserGestureIndicator gestureIndicator(m_shouldForwardUserGesture ? DefinitelyProcessingUserGesture : PossiblyProcessingUserGesture); // Only the first execution of a multi-shot timer should get an affirmative user gesture indicator. m_shouldForwardUserGesture = false; InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutId); // Simple case for non-one-shot timers. if (isActive()) { double minimumInterval = context->minimumTimerInterval(); if (repeatInterval() && repeatInterval() < minimumInterval) { m_nestingLevel++; if (m_nestingLevel >= maxTimerNestingLevel) augmentRepeatInterval(minimumInterval - repeatInterval()); } // No access to member variables after this point, it can delete the timer. m_action->execute(context); InspectorInstrumentation::didFireTimer(cookie); return; } // Delete timer before executing the action for one-shot timers. OwnPtr<ScheduledAction> action = m_action.release(); // No access to member variables after this point. delete this; action->execute(context); InspectorInstrumentation::didFireTimer(cookie); timerNestingLevel = 0; }
void DOMTimer::fired() { ExecutionContext* context = executionContext(); timerNestingLevel = m_nestingLevel; ASSERT(!context->activeDOMObjectsAreSuspended()); // Only the first execution of a multi-shot timer should get an affirmative user gesture indicator. UserGestureIndicator gestureIndicator(m_userGestureToken.release()); InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutID); // Simple case for non-one-shot timers. if (isActive()) { if (repeatInterval() && repeatInterval() < minimumInterval) { m_nestingLevel++; if (m_nestingLevel >= maxTimerNestingLevel) augmentRepeatInterval(minimumInterval - repeatInterval()); } // No access to member variables after this point, it can delete the timer. m_action->execute(context); InspectorInstrumentation::didFireTimer(cookie); return; } // Delete timer before executing the action for one-shot timers. OwnPtr<ScheduledAction> action = m_action.release(); // This timer is being deleted; no access to member variables allowed after this point. context->removeTimeoutByID(m_timeoutID); action->execute(context); InspectorInstrumentation::didFireTimer(cookie); timerNestingLevel = 0; }
void DOMTimer::fired() { ScriptExecutionContext* context = scriptExecutionContext(); ASSERT(context); #if PLATFORM(IOS) Document* document = nullptr; if (!context->isDocument()) { document = toDocument(context); ASSERT(!document->frame()->timersPaused()); } #endif timerNestingLevel = m_nestingLevel; ASSERT(!isSuspended()); ASSERT(!context->activeDOMObjectsAreSuspended()); UserGestureIndicator gestureIndicator(m_shouldForwardUserGesture ? DefinitelyProcessingUserGesture : PossiblyProcessingUserGesture); // Only the first execution of a multi-shot timer should get an affirmative user gesture indicator. m_shouldForwardUserGesture = false; InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutId); // Simple case for non-one-shot timers. if (isActive()) { double minimumInterval = context->minimumTimerInterval(); if (repeatInterval() && repeatInterval() < minimumInterval) { m_nestingLevel++; if (m_nestingLevel >= maxTimerNestingLevel) augmentRepeatInterval(minimumInterval - repeatInterval()); } // No access to member variables after this point, it can delete the timer. m_action->execute(context); InspectorInstrumentation::didFireTimer(cookie); return; } // Delete timer before executing the action for one-shot timers. OwnPtr<ScheduledAction> action = m_action.release(); // No access to member variables after this point. delete this; #if PLATFORM(IOS) bool shouldReportLackOfChanges; bool shouldBeginObservingChanges; if (document) { shouldReportLackOfChanges = WebThreadCountOfObservedContentModifiers() == 1; shouldBeginObservingChanges = WebThreadContainsObservedContentModifier(this); } else { shouldReportLackOfChanges = false; shouldBeginObservingChanges = false; } if (shouldBeginObservingChanges) { WKBeginObservingContentChanges(false); WebThreadRemoveObservedContentModifier(this); } #endif action->execute(context); #if PLATFORM(IOS) if (shouldBeginObservingChanges) { WKStopObservingContentChanges(); if (WKObservedContentChange() == WKContentVisibilityChange || shouldReportLackOfChanges) if (document && document->page()) document->page()->chrome().client().observedContentChange(document->frame()); } #endif InspectorInstrumentation::didFireTimer(cookie); timerNestingLevel = 0; }