OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Samsung Electronics | 2 * Copyright (C) 2012 Samsung Electronics |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 DCHECK(timer == &m_timerDoVibrate); | 118 DCHECK(timer == &m_timerDoVibrate); |
119 | 119 |
120 if (m_pattern.isEmpty()) | 120 if (m_pattern.isEmpty()) |
121 m_isRunning = false; | 121 m_isRunning = false; |
122 | 122 |
123 if (!m_isRunning || m_isCallingCancel || m_isCallingVibrate || !getExecution
Context() || !page()->isPageVisible()) | 123 if (!m_isRunning || m_isCallingCancel || m_isCallingVibrate || !getExecution
Context() || !page()->isPageVisible()) |
124 return; | 124 return; |
125 | 125 |
126 if (m_service) { | 126 if (m_service) { |
127 m_isCallingVibrate = true; | 127 m_isCallingVibrate = true; |
128 m_service->Vibrate(m_pattern[0], createBaseCallback(bind(&VibrationContr
oller::didVibrate, wrapPersistent(this)))); | 128 m_service->Vibrate(m_pattern[0], createBaseCallback(WTF::bind(&Vibration
Controller::didVibrate, wrapPersistent(this)))); |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 void VibrationController::didVibrate() | 132 void VibrationController::didVibrate() |
133 { | 133 { |
134 m_isCallingVibrate = false; | 134 m_isCallingVibrate = false; |
135 | 135 |
136 // If the pattern is empty here, it was probably cleared by a fresh call to | 136 // If the pattern is empty here, it was probably cleared by a fresh call to |
137 // |vibrate| while the mojo call was in flight. | 137 // |vibrate| while the mojo call was in flight. |
138 if (m_pattern.isEmpty()) | 138 if (m_pattern.isEmpty()) |
(...skipping 14 matching lines...) Expand all Loading... |
153 | 153 |
154 void VibrationController::cancel() | 154 void VibrationController::cancel() |
155 { | 155 { |
156 m_pattern.clear(); | 156 m_pattern.clear(); |
157 | 157 |
158 if (m_timerDoVibrate.isActive()) | 158 if (m_timerDoVibrate.isActive()) |
159 m_timerDoVibrate.stop(); | 159 m_timerDoVibrate.stop(); |
160 | 160 |
161 if (m_isRunning && !m_isCallingCancel && m_service) { | 161 if (m_isRunning && !m_isCallingCancel && m_service) { |
162 m_isCallingCancel = true; | 162 m_isCallingCancel = true; |
163 m_service->Cancel(createBaseCallback(bind(&VibrationController::didCance
l, wrapPersistent(this)))); | 163 m_service->Cancel(createBaseCallback(WTF::bind(&VibrationController::did
Cancel, wrapPersistent(this)))); |
164 } | 164 } |
165 | 165 |
166 m_isRunning = false; | 166 m_isRunning = false; |
167 } | 167 } |
168 | 168 |
169 void VibrationController::didCancel() | 169 void VibrationController::didCancel() |
170 { | 170 { |
171 m_isCallingCancel = false; | 171 m_isCallingCancel = false; |
172 | 172 |
173 // A new vibration pattern may have been set while the mojo call for | 173 // A new vibration pattern may have been set while the mojo call for |
(...skipping 23 matching lines...) Expand all Loading... |
197 cancel(); | 197 cancel(); |
198 } | 198 } |
199 | 199 |
200 DEFINE_TRACE(VibrationController) | 200 DEFINE_TRACE(VibrationController) |
201 { | 201 { |
202 ContextLifecycleObserver::trace(visitor); | 202 ContextLifecycleObserver::trace(visitor); |
203 PageLifecycleObserver::trace(visitor); | 203 PageLifecycleObserver::trace(visitor); |
204 } | 204 } |
205 | 205 |
206 } // namespace blink | 206 } // namespace blink |
OLD | NEW |