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 28 matching lines...) Expand all Loading... |
39 static const double oneMillisecond = 0.001; | 39 static const double oneMillisecond = 0.001; |
40 // Chromium uses a minimum timer interval of 4ms. We'd like to go | 40 // Chromium uses a minimum timer interval of 4ms. We'd like to go |
41 // lower; however, there are poorly coded websites out there which do | 41 // lower; however, there are poorly coded websites out there which do |
42 // create CPU-spinning loops. Using 4ms prevents the CPU from | 42 // create CPU-spinning loops. Using 4ms prevents the CPU from |
43 // spinning too busily and provides a balance between CPU spinning and | 43 // spinning too busily and provides a balance between CPU spinning and |
44 // the smallest possible interval timer. | 44 // the smallest possible interval timer. |
45 static const double minimumInterval = 0.004; | 45 static const double minimumInterval = 0.004; |
46 | 46 |
47 static inline bool shouldForwardUserGesture(int interval, int nestingLevel) | 47 static inline bool shouldForwardUserGesture(int interval, int nestingLevel) |
48 { | 48 { |
49 return UserGestureIndicator::processingUserGesture() | 49 return UserGestureIndicator::processingUserGestureUntracked() |
50 && interval <= maxIntervalForUserGestureForwarding | 50 && interval <= maxIntervalForUserGestureForwarding |
51 && nestingLevel == 1; // Gestures should not be forwarded to nested time
rs. | 51 && nestingLevel == 1; // Gestures should not be forwarded to nested time
rs. |
52 } | 52 } |
53 | 53 |
54 int DOMTimer::install(ExecutionContext* context, RawPtr<ScheduledAction> action,
int timeout, bool singleShot) | 54 int DOMTimer::install(ExecutionContext* context, RawPtr<ScheduledAction> action,
int timeout, bool singleShot) |
55 { | 55 { |
56 int timeoutID = context->timers()->installNewTimeout(context, action, timeou
t, singleShot); | 56 int timeoutID = context->timers()->installNewTimeout(context, action, timeou
t, singleShot); |
57 TRACE_EVENT_INSTANT1("devtools.timeline", "TimerInstall", TRACE_EVENT_SCOPE_
THREAD, "data", InspectorTimerInstallEvent::data(context, timeoutID, timeout, si
ngleShot)); | 57 TRACE_EVENT_INSTANT1("devtools.timeline", "TimerInstall", TRACE_EVENT_SCOPE_
THREAD, "data", InspectorTimerInstallEvent::data(context, timeoutID, timeout, si
ngleShot)); |
58 InspectorInstrumentation::didInstallTimer(context, timeoutID, timeout, singl
eShot); | 58 InspectorInstrumentation::didInstallTimer(context, timeoutID, timeout, singl
eShot); |
59 return timeoutID; | 59 return timeoutID; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 return getExecutionContext()->timers()->timerTaskRunner(); | 155 return getExecutionContext()->timers()->timerTaskRunner(); |
156 } | 156 } |
157 | 157 |
158 DEFINE_TRACE(DOMTimer) | 158 DEFINE_TRACE(DOMTimer) |
159 { | 159 { |
160 visitor->trace(m_action); | 160 visitor->trace(m_action); |
161 SuspendableTimer::trace(visitor); | 161 SuspendableTimer::trace(visitor); |
162 } | 162 } |
163 | 163 |
164 } // namespace blink | 164 } // namespace blink |
OLD | NEW |