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 10 matching lines...) Expand all Loading... |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 * | 24 * |
25 */ | 25 */ |
26 | 26 |
27 #include "core/frame/DOMTimer.h" | 27 #include "core/frame/DOMTimer.h" |
28 | 28 |
29 #include "core/dom/ExecutionContext.h" | 29 #include "core/dom/ExecutionContext.h" |
30 #include "core/dom/TaskRunnerHelper.h" | 30 #include "core/dom/TaskRunnerHelper.h" |
31 #include "core/frame/PerformanceMonitor.h" | |
32 #include "core/inspector/InspectorInstrumentation.h" | 31 #include "core/inspector/InspectorInstrumentation.h" |
33 #include "core/inspector/InspectorTraceEvents.h" | 32 #include "core/inspector/InspectorTraceEvents.h" |
34 #include "platform/instrumentation/tracing/TraceEvent.h" | 33 #include "platform/instrumentation/tracing/TraceEvent.h" |
35 #include "wtf/CurrentTime.h" | 34 #include "wtf/CurrentTime.h" |
36 | 35 |
37 namespace blink { | 36 namespace blink { |
38 | 37 |
39 static const int maxIntervalForUserGestureForwarding = | 38 static const int maxIntervalForUserGestureForwarding = |
40 1000; // One second matches Gecko. | 39 1000; // One second matches Gecko. |
41 static const int maxTimerNestingLevel = 5; | 40 static const int maxTimerNestingLevel = 5; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 ExecutionContext* context = getExecutionContext(); | 135 ExecutionContext* context = getExecutionContext(); |
137 ASSERT(context); | 136 ASSERT(context); |
138 context->timers()->setTimerNestingLevel(m_nestingLevel); | 137 context->timers()->setTimerNestingLevel(m_nestingLevel); |
139 DCHECK(!context->isContextSuspended()); | 138 DCHECK(!context->isContextSuspended()); |
140 // Only the first execution of a multi-shot timer should get an affirmative | 139 // Only the first execution of a multi-shot timer should get an affirmative |
141 // user gesture indicator. | 140 // user gesture indicator. |
142 UserGestureIndicator gestureIndicator(std::move(m_userGestureToken)); | 141 UserGestureIndicator gestureIndicator(std::move(m_userGestureToken)); |
143 | 142 |
144 TRACE_EVENT1("devtools.timeline", "TimerFire", "data", | 143 TRACE_EVENT1("devtools.timeline", "TimerFire", "data", |
145 InspectorTimerFireEvent::data(context, m_timeoutID)); | 144 InspectorTimerFireEvent::data(context, m_timeoutID)); |
146 PerformanceMonitor::HandlerCall handlerCall( | 145 probe::UserCallback probe(context, |
147 context, repeatInterval() ? "setInterval" : "setTimeout", true); | 146 repeatInterval() ? "setInterval" : "setTimeout", |
| 147 AtomicString(), true); |
148 probe::AsyncTask asyncTask(context, this, "timerFired"); | 148 probe::AsyncTask asyncTask(context, this, "timerFired"); |
149 | 149 |
150 // Simple case for non-one-shot timers. | 150 // Simple case for non-one-shot timers. |
151 if (isActive()) { | 151 if (isActive()) { |
152 if (repeatInterval() && repeatInterval() < minimumInterval) { | 152 if (repeatInterval() && repeatInterval() < minimumInterval) { |
153 m_nestingLevel++; | 153 m_nestingLevel++; |
154 if (m_nestingLevel >= maxTimerNestingLevel) | 154 if (m_nestingLevel >= maxTimerNestingLevel) |
155 augmentRepeatInterval(minimumInterval - repeatInterval()); | 155 augmentRepeatInterval(minimumInterval - repeatInterval()); |
156 } | 156 } |
157 | 157 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 RefPtr<WebTaskRunner> DOMTimer::timerTaskRunner() const { | 189 RefPtr<WebTaskRunner> DOMTimer::timerTaskRunner() const { |
190 return getExecutionContext()->timers()->timerTaskRunner(); | 190 return getExecutionContext()->timers()->timerTaskRunner(); |
191 } | 191 } |
192 | 192 |
193 DEFINE_TRACE(DOMTimer) { | 193 DEFINE_TRACE(DOMTimer) { |
194 visitor->trace(m_action); | 194 visitor->trace(m_action); |
195 SuspendableTimer::trace(visitor); | 195 SuspendableTimer::trace(visitor); |
196 } | 196 } |
197 | 197 |
198 } // namespace blink | 198 } // namespace blink |
OLD | NEW |