Пример #1
0
InspectorInstrumentationCookie InspectorInstrumentation::willFireTimerImpl(InspectorController* inspectorController, int timerId)
{
    pauseOnNativeEventIfNeeded(inspectorController, instrumentationEventCategoryType, timerFiredEventName, false);

    int timelineAgentId = 0;
    InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController);
    if (timelineAgent) {
        timelineAgent->willFireTimer(timerId);
        timelineAgentId = timelineAgent->id();
    }
    return InspectorInstrumentationCookie(inspectorController, timelineAgentId);
}
Пример #2
0
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;
}