| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   61     // second at most. |   61     // second at most. | 
|   62     return 1.0; |   62     return 1.0; | 
|   63 } |   63 } | 
|   64  |   64  | 
|   65 double DOMTimer::visiblePageAlignmentInterval() |   65 double DOMTimer::visiblePageAlignmentInterval() | 
|   66 { |   66 { | 
|   67     // Alignment does not apply to timers on visible pages. |   67     // Alignment does not apply to timers on visible pages. | 
|   68     return 0; |   68     return 0; | 
|   69 } |   69 } | 
|   70  |   70  | 
|   71 int DOMTimer::install(ExecutionContext* context, PassOwnPtr<ScheduledAction> act
     ion, int timeout, bool singleShot) |   71 int DOMTimer::install(ExecutionContext* context, PassOwnPtr<ScheduledActionBase>
      action, int timeout, bool singleShot) | 
|   72 { |   72 { | 
|   73     int timeoutID = context->installNewTimeout(action, timeout, singleShot); |   73     int timeoutID = context->installNewTimeout(action, timeout, singleShot); | 
|   74     TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimerI
     nstall", "data", InspectorTimerInstallEvent::data(context, timeoutID, timeout, s
     ingleShot)); |   74     TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimerI
     nstall", "data", InspectorTimerInstallEvent::data(context, timeoutID, timeout, s
     ingleShot)); | 
|   75     TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
     CallStack", "stack", InspectorCallStackEvent::currentCallStack()); |   75     TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
     CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 
|   76     // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
     ne migrates to tracing. |   76     // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
     ne migrates to tracing. | 
|   77     InspectorInstrumentation::didInstallTimer(context, timeoutID, timeout, singl
     eShot); |   77     InspectorInstrumentation::didInstallTimer(context, timeoutID, timeout, singl
     eShot); | 
|   78     WTF_LOG(Timers, "DOMTimer::install: timeoutID = %d, timeout = %d, singleShot
      = %d", timeoutID, timeout, singleShot ? 1 : 0); |   78     WTF_LOG(Timers, "DOMTimer::install: timeoutID = %d, timeout = %d, singleShot
      = %d", timeoutID, timeout, singleShot ? 1 : 0); | 
|   79     return timeoutID; |   79     return timeoutID; | 
|   80 } |   80 } | 
|   81  |   81  | 
|   82 void DOMTimer::removeByID(ExecutionContext* context, int timeoutID) |   82 void DOMTimer::removeByID(ExecutionContext* context, int timeoutID) | 
|   83 { |   83 { | 
|   84     WTF_LOG(Timers, "DOMTimer::removeByID: timeoutID = %d", timeoutID); |   84     WTF_LOG(Timers, "DOMTimer::removeByID: timeoutID = %d", timeoutID); | 
|   85     context->removeTimeoutByID(timeoutID); |   85     context->removeTimeoutByID(timeoutID); | 
|   86     TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimerR
     emove", "data", InspectorTimerRemoveEvent::data(context, timeoutID)); |   86     TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimerR
     emove", "data", InspectorTimerRemoveEvent::data(context, timeoutID)); | 
|   87     TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
     CallStack", "stack", InspectorCallStackEvent::currentCallStack()); |   87     TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
     CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 
|   88     // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
     ne migrates to tracing. |   88     // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
     ne migrates to tracing. | 
|   89     InspectorInstrumentation::didRemoveTimer(context, timeoutID); |   89     InspectorInstrumentation::didRemoveTimer(context, timeoutID); | 
|   90 } |   90 } | 
|   91  |   91  | 
|   92 DOMTimer::DOMTimer(ExecutionContext* context, PassOwnPtr<ScheduledAction> action
     , int interval, bool singleShot, int timeoutID) |   92 DOMTimer::DOMTimer(ExecutionContext* context, PassOwnPtr<ScheduledActionBase> ac
     tion, int interval, bool singleShot, int timeoutID) | 
|   93     : SuspendableTimer(context) |   93     : SuspendableTimer(context) | 
|   94     , m_timeoutID(timeoutID) |   94     , m_timeoutID(timeoutID) | 
|   95     , m_nestingLevel(timerNestingLevel + 1) |   95     , m_nestingLevel(timerNestingLevel + 1) | 
|   96     , m_action(action) |   96     , m_action(action) | 
|   97 { |   97 { | 
|   98     ASSERT(timeoutID > 0); |   98     ASSERT(timeoutID > 0); | 
|   99     if (shouldForwardUserGesture(interval, m_nestingLevel)) |   99     if (shouldForwardUserGesture(interval, m_nestingLevel)) | 
|  100         m_userGestureToken = UserGestureIndicator::currentToken(); |  100         m_userGestureToken = UserGestureIndicator::currentToken(); | 
|  101  |  101  | 
|  102     double intervalMilliseconds = std::max(oneMillisecond, interval * oneMillise
     cond); |  102     double intervalMilliseconds = std::max(oneMillisecond, interval * oneMillise
     cond); | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  143         m_action->execute(context); |  143         m_action->execute(context); | 
|  144  |  144  | 
|  145         InspectorInstrumentation::didFireTimer(cookie); |  145         InspectorInstrumentation::didFireTimer(cookie); | 
|  146  |  146  | 
|  147         return; |  147         return; | 
|  148     } |  148     } | 
|  149  |  149  | 
|  150     WTF_LOG(Timers, "DOMTimer::fired: m_timeoutID = %d, one-shot, m_action = %p"
     , m_timeoutID, m_action.get()); |  150     WTF_LOG(Timers, "DOMTimer::fired: m_timeoutID = %d, one-shot, m_action = %p"
     , m_timeoutID, m_action.get()); | 
|  151  |  151  | 
|  152     // Delete timer before executing the action for one-shot timers. |  152     // Delete timer before executing the action for one-shot timers. | 
|  153     OwnPtr<ScheduledAction> action = m_action.release(); |  153     OwnPtr<ScheduledActionBase> action = m_action.release(); | 
|  154  |  154  | 
|  155     // This timer is being deleted; no access to member variables allowed after 
     this point. |  155     // This timer is being deleted; no access to member variables allowed after 
     this point. | 
|  156     context->removeTimeoutByID(m_timeoutID); |  156     context->removeTimeoutByID(m_timeoutID); | 
|  157  |  157  | 
|  158     action->execute(context); |  158     action->execute(context); | 
|  159  |  159  | 
|  160     InspectorInstrumentation::didFireTimer(cookie); |  160     InspectorInstrumentation::didFireTimer(cookie); | 
|  161     TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
     Counters", "data", InspectorUpdateCountersEvent::data()); |  161     TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
     Counters", "data", InspectorUpdateCountersEvent::data()); | 
|  162  |  162  | 
|  163     timerNestingLevel = 0; |  163     timerNestingLevel = 0; | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  207         if (fireTime - alignedTimeRoundedDown < minimumInterval) |  207         if (fireTime - alignedTimeRoundedDown < minimumInterval) | 
|  208             return alignedTimeRoundedDown; |  208             return alignedTimeRoundedDown; | 
|  209  |  209  | 
|  210         return alignedTimeRoundedUp; |  210         return alignedTimeRoundedUp; | 
|  211     } |  211     } | 
|  212  |  212  | 
|  213     return fireTime; |  213     return fireTime; | 
|  214 } |  214 } | 
|  215  |  215  | 
|  216 } // namespace blink |  216 } // namespace blink | 
| OLD | NEW |