OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 WTF_MAKE_NONCOPYABLE(GestureToken); | 42 WTF_MAKE_NONCOPYABLE(GestureToken); |
43 | 43 |
44 public: | 44 public: |
45 static PassRefPtr<UserGestureToken> create() { | 45 static PassRefPtr<UserGestureToken> create() { |
46 return adoptRef(new GestureToken); | 46 return adoptRef(new GestureToken); |
47 } | 47 } |
48 | 48 |
49 ~GestureToken() final {} | 49 ~GestureToken() final {} |
50 | 50 |
51 bool hasGestures() const override { | 51 bool hasGestures() const override { |
52 // Do not enforce timeouts for gestures which spawned javascript prompts or
debugger pause. | 52 // Do not enforce timeouts for gestures which spawned javascript prompts or |
| 53 // debugger pause. |
53 if (m_consumableGestures < 1 || | 54 if (m_consumableGestures < 1 || |
54 (!m_javascriptPrompt && !m_pauseInDebugger && | 55 (!m_javascriptPrompt && !m_pauseInDebugger && |
55 hasTimedOut(m_outOfProcess ? userGestureOutOfProcessTimeout | 56 hasTimedOut(m_outOfProcess ? userGestureOutOfProcessTimeout |
56 : userGestureTimeout))) | 57 : userGestureTimeout))) |
57 return false; | 58 return false; |
58 return true; | 59 return true; |
59 } | 60 } |
60 | 61 |
61 void addGesture() { | 62 void addGesture() { |
62 m_consumableGestures++; | 63 m_consumableGestures++; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 ProcessingUserGestureState state, | 129 ProcessingUserGestureState state, |
129 UserGestureUtilizedCallback* usageCallback) | 130 UserGestureUtilizedCallback* usageCallback) |
130 : m_previousState(DefinitelyNotProcessingUserGesture), | 131 : m_previousState(DefinitelyNotProcessingUserGesture), |
131 m_usageCallback(usageCallback) { | 132 m_usageCallback(usageCallback) { |
132 // Silently ignore UserGestureIndicators on non-main threads. | 133 // Silently ignore UserGestureIndicators on non-main threads. |
133 if (!isMainThread()) | 134 if (!isMainThread()) |
134 return; | 135 return; |
135 | 136 |
136 m_previousState = s_state; | 137 m_previousState = s_state; |
137 | 138 |
138 // We overwrite s_state only if the caller is definite about the gesture state
. | 139 // We overwrite s_state only if the caller is definite about the gesture |
| 140 // state. |
139 if (isDefinite(state)) { | 141 if (isDefinite(state)) { |
140 if (!s_topmostIndicator) { | 142 if (!s_topmostIndicator) { |
141 s_topmostIndicator = this; | 143 s_topmostIndicator = this; |
142 m_token = GestureToken::create(); | 144 m_token = GestureToken::create(); |
143 } else { | 145 } else { |
144 m_token = currentToken(); | 146 m_token = currentToken(); |
145 } | 147 } |
146 s_state = state; | 148 s_state = state; |
147 } | 149 } |
148 | 150 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } | 248 } |
247 | 249 |
248 // static | 250 // static |
249 bool UserGestureIndicator::processedUserGestureSinceLoad() { | 251 bool UserGestureIndicator::processedUserGestureSinceLoad() { |
250 if (!isMainThread()) | 252 if (!isMainThread()) |
251 return false; | 253 return false; |
252 return s_processedUserGestureSinceLoad; | 254 return s_processedUserGestureSinceLoad; |
253 } | 255 } |
254 | 256 |
255 } // namespace blink | 257 } // namespace blink |
OLD | NEW |