| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 double DOMTimer::visiblePageAlignmentInterval() | 64 double DOMTimer::visiblePageAlignmentInterval() |
| 65 { | 65 { |
| 66 // Alignment does not apply to timers on visible pages. | 66 // Alignment does not apply to timers on visible pages. |
| 67 return 0; | 67 return 0; |
| 68 } | 68 } |
| 69 | 69 |
| 70 int DOMTimer::install(ExecutionContext* context, PassOwnPtr<ScheduledAction> act
ion, int timeout, bool singleShot) | 70 int DOMTimer::install(ExecutionContext* context, PassOwnPtr<ScheduledAction> act
ion, int timeout, bool singleShot) |
| 71 { | 71 { |
| 72 int timeoutID = context->installNewTimeout(action, timeout, singleShot); | 72 int timeoutID = context->installNewTimeout(action, timeout, singleShot); |
| 73 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimerI
nstall", "data", InspectorTimerInstallEvent::data(context, timeoutID, timeout, s
ingleShot)); | 73 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimerI
nstall", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorTimerInstallEvent::data(con
text, timeoutID, timeout, singleShot)); |
| 74 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 74 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); |
| 75 WTF_LOG(Timers, "DOMTimer::install: timeoutID = %d, timeout = %d, singleShot
= %d", timeoutID, timeout, singleShot ? 1 : 0); | 75 WTF_LOG(Timers, "DOMTimer::install: timeoutID = %d, timeout = %d, singleShot
= %d", timeoutID, timeout, singleShot ? 1 : 0); |
| 76 return timeoutID; | 76 return timeoutID; |
| 77 } | 77 } |
| 78 | 78 |
| 79 void DOMTimer::removeByID(ExecutionContext* context, int timeoutID) | 79 void DOMTimer::removeByID(ExecutionContext* context, int timeoutID) |
| 80 { | 80 { |
| 81 WTF_LOG(Timers, "DOMTimer::removeByID: timeoutID = %d", timeoutID); | 81 WTF_LOG(Timers, "DOMTimer::removeByID: timeoutID = %d", timeoutID); |
| 82 context->removeTimeoutByID(timeoutID); | 82 context->removeTimeoutByID(timeoutID); |
| 83 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimerR
emove", "data", InspectorTimerRemoveEvent::data(context, timeoutID)); | 83 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimerR
emove", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorTimerRemoveEvent::data(conte
xt, timeoutID)); |
| 84 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 84 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 DOMTimer::DOMTimer(ExecutionContext* context, PassOwnPtr<ScheduledAction> action
, int interval, bool singleShot, int timeoutID) | 87 DOMTimer::DOMTimer(ExecutionContext* context, PassOwnPtr<ScheduledAction> action
, int interval, bool singleShot, int timeoutID) |
| 88 : SuspendableTimer(context) | 88 : SuspendableTimer(context) |
| 89 , m_timeoutID(timeoutID) | 89 , m_timeoutID(timeoutID) |
| 90 , m_nestingLevel(timerNestingLevel + 1) | 90 , m_nestingLevel(timerNestingLevel + 1) |
| 91 , m_action(action) | 91 , m_action(action) |
| 92 { | 92 { |
| 93 ASSERT(timeoutID > 0); | 93 ASSERT(timeoutID > 0); |
| 94 if (shouldForwardUserGesture(interval, m_nestingLevel)) | 94 if (shouldForwardUserGesture(interval, m_nestingLevel)) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 WTF_LOG(Timers, "DOMTimer::fired: m_timeoutID = %d, one-shot, m_action = %p"
, m_timeoutID, m_action.get()); | 140 WTF_LOG(Timers, "DOMTimer::fired: m_timeoutID = %d, one-shot, m_action = %p"
, m_timeoutID, m_action.get()); |
| 141 | 141 |
| 142 // Delete timer before executing the action for one-shot timers. | 142 // Delete timer before executing the action for one-shot timers. |
| 143 OwnPtr<ScheduledAction> action = m_action.release(); | 143 OwnPtr<ScheduledAction> action = m_action.release(); |
| 144 | 144 |
| 145 // This timer is being deleted; no access to member variables allowed after
this point. | 145 // This timer is being deleted; no access to member variables allowed after
this point. |
| 146 context->removeTimeoutByID(m_timeoutID); | 146 context->removeTimeoutByID(m_timeoutID); |
| 147 | 147 |
| 148 action->execute(context); | 148 action->execute(context); |
| 149 | 149 |
| 150 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", "data", InspectorUpdateCountersEvent::data()); | 150 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEvent::data
()); |
| 151 | 151 |
| 152 timerNestingLevel = 0; | 152 timerNestingLevel = 0; |
| 153 } | 153 } |
| 154 | 154 |
| 155 void DOMTimer::contextDestroyed() | 155 void DOMTimer::contextDestroyed() |
| 156 { | 156 { |
| 157 SuspendableTimer::contextDestroyed(); | 157 SuspendableTimer::contextDestroyed(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void DOMTimer::stop() | 160 void DOMTimer::stop() |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 if (fireTime - alignedTimeRoundedDown < minimumInterval) | 196 if (fireTime - alignedTimeRoundedDown < minimumInterval) |
| 197 return alignedTimeRoundedDown; | 197 return alignedTimeRoundedDown; |
| 198 | 198 |
| 199 return alignedTimeRoundedUp; | 199 return alignedTimeRoundedUp; |
| 200 } | 200 } |
| 201 | 201 |
| 202 return fireTime; | 202 return fireTime; |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace blink | 205 } // namespace blink |
| OLD | NEW |