| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 // If any pattern entry is too long then truncate it. | 47 // If any pattern entry is too long then truncate it. |
| 48 for (size_t i = 0; i < length; ++i) { | 48 for (size_t i = 0; i < length; ++i) { |
| 49 if (sanitized[i] > kVibrationDurationMsMax) | 49 if (sanitized[i] > kVibrationDurationMsMax) |
| 50 sanitized[i] = kVibrationDurationMsMax; | 50 sanitized[i] = kVibrationDurationMsMax; |
| 51 } | 51 } |
| 52 | 52 |
| 53 // If the last item in the pattern is a pause then discard it. | 53 // If the last item in the pattern is a pause then discard it. |
| 54 if (length && !(length % 2)) | 54 if (length && !(length % 2)) |
| 55 sanitized.removeLast(); | 55 sanitized.pop_back(); |
| 56 | 56 |
| 57 return sanitized; | 57 return sanitized; |
| 58 } | 58 } |
| 59 | 59 |
| 60 namespace blink { | 60 namespace blink { |
| 61 | 61 |
| 62 // static | 62 // static |
| 63 VibrationController::VibrationPattern | 63 VibrationController::VibrationPattern |
| 64 VibrationController::sanitizeVibrationPattern( | 64 VibrationController::sanitizeVibrationPattern( |
| 65 const UnsignedLongOrUnsignedLongSequence& pattern) { | 65 const UnsignedLongOrUnsignedLongSequence& pattern) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |