| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 void VibrationController::didVibrate() { | 139 void VibrationController::didVibrate() { |
| 140 m_isCallingVibrate = false; | 140 m_isCallingVibrate = false; |
| 141 | 141 |
| 142 // If the pattern is empty here, it was probably cleared by a fresh call to | 142 // If the pattern is empty here, it was probably cleared by a fresh call to |
| 143 // |vibrate| while the mojo call was in flight. | 143 // |vibrate| while the mojo call was in flight. |
| 144 if (m_pattern.isEmpty()) | 144 if (m_pattern.isEmpty()) |
| 145 return; | 145 return; |
| 146 | 146 |
| 147 // Use the current vibration entry of the pattern as the initial interval. | 147 // Use the current vibration entry of the pattern as the initial interval. |
| 148 unsigned interval = m_pattern[0]; | 148 unsigned interval = m_pattern[0]; |
| 149 m_pattern.remove(0); | 149 m_pattern.erase(0); |
| 150 | 150 |
| 151 // If there is another entry it is for a pause. | 151 // If there is another entry it is for a pause. |
| 152 if (!m_pattern.isEmpty()) { | 152 if (!m_pattern.isEmpty()) { |
| 153 interval += m_pattern[0]; | 153 interval += m_pattern[0]; |
| 154 m_pattern.remove(0); | 154 m_pattern.erase(0); |
| 155 } | 155 } |
| 156 | 156 |
| 157 m_timerDoVibrate.startOneShot(interval / 1000.0, BLINK_FROM_HERE); | 157 m_timerDoVibrate.startOneShot(interval / 1000.0, BLINK_FROM_HERE); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void VibrationController::cancel() { | 160 void VibrationController::cancel() { |
| 161 m_pattern.clear(); | 161 m_pattern.clear(); |
| 162 m_timerDoVibrate.stop(); | 162 m_timerDoVibrate.stop(); |
| 163 | 163 |
| 164 if (m_isRunning && !m_isCallingCancel && m_vibrationManager) { | 164 if (m_isRunning && !m_isCallingCancel && m_vibrationManager) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 190 if (!page()->isPageVisible()) | 190 if (!page()->isPageVisible()) |
| 191 cancel(); | 191 cancel(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 DEFINE_TRACE(VibrationController) { | 194 DEFINE_TRACE(VibrationController) { |
| 195 ContextLifecycleObserver::trace(visitor); | 195 ContextLifecycleObserver::trace(visitor); |
| 196 PageVisibilityObserver::trace(visitor); | 196 PageVisibilityObserver::trace(visitor); |
| 197 } | 197 } |
| 198 | 198 |
| 199 } // namespace blink | 199 } // namespace blink |
| OLD | NEW |