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() { 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; }