RESOLVED FIXED 117822
Vibration cannot be canceled during pattern vibration.
https://bugs.webkit.org/show_bug.cgi?id=117822
Summary Vibration cannot be canceled during pattern vibration.
Kihong Kwon
Reported 2013-06-19 22:55:41 PDT
Vibration can not cancel during pattern vibration is working. If resting time which are even numbers of pattern m_isVibraing is false, therefore if cancel is called it is returned. In addition, m_timerStart need to stop in the cancelVibration() with m_timerStop.stop(). If cancelVibration is called right after m_timerStart is fired, timerStartFired function can be called even if vibration is already canceled because of timing issue of timer.
Attachments
Patch (6.07 KB, patch)
2013-06-19 23:03 PDT, Kihong Kwon
no flags
Patch (7.62 KB, patch)
2013-06-26 03:45 PDT, Kihong Kwon
no flags
Patch (7.61 KB, patch)
2013-06-26 04:49 PDT, Kihong Kwon
no flags
Patch (8.32 KB, patch)
2013-06-26 05:33 PDT, Kihong Kwon
no flags
Kihong Kwon
Comment 1 2013-06-19 23:03:37 PDT
Gyuyoung Kim
Comment 2 2013-06-25 22:28:35 PDT
Comment on attachment 205061 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=205061&action=review > Source/WebCore/Modules/vibration/Vibration.cpp:-94 > - cancelVibration(); Isn't it better to call cancelVibration() ? I think cancelVibration() does same work. > Source/WebCore/Modules/vibration/Vibration.cpp:128 > + if (!m_pattern.size()) Why not use m_pattern.isEmpty() ? > LayoutTests/vibration/cancelVibrationDuringPatternVibrating.html:14 > + navigator.vibrate([100, 100, 100, 100, 100]); Looks wrong indentation. > LayoutTests/vibration/cancelVibrationDuringPatternVibrating.html:24 > + finishJSTest(); ditto.
Kihong Kwon
Comment 3 2013-06-26 02:20:05 PDT
(In reply to comment #2) > (From update of attachment 205061 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=205061&action=review > > > Source/WebCore/Modules/vibration/Vibration.cpp:-94 > > - cancelVibration(); > > Isn't it better to call cancelVibration() ? I think cancelVibration() does same work. m_pattern is cleared in the cancelVibration but suspenVibration need to add left time to the pattern. therefore It's little bit different. > > > Source/WebCore/Modules/vibration/Vibration.cpp:128 > > + if (!m_pattern.size()) > > Why not use m_pattern.isEmpty() ? I'll change to isEmpty().
Kihong Kwon
Comment 4 2013-06-26 03:45:38 PDT
Chris Dumez
Comment 5 2013-06-26 03:59:25 PDT
Comment on attachment 205466 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=205466&action=review LGTM but a few nits: > Source/WebCore/ChangeLog:8 > + Vibration can not cancel during pattern vibration is working. If resting time which are "Vibration cannot be canceled during pattern vibration." > Source/WebCore/ChangeLog:9 > + even numbers of pattern m_isVibraing is false, therefore if cancel is called it is returned. "... m_isVibrating will be false and cancel() will thus return early." > Source/WebCore/ChangeLog:10 > + In addition, m_timerStart need to stop in the cancelVibration() with m_timerStop.stop(). "In addition, m_timerStart needs to be stopped in the cancelVibration()." > Source/WebCore/ChangeLog:11 > + If cancelVibration is called right after m_timerStart is fired, timerStartFired "cancelVibration()" > LayoutTests/ChangeLog:3 > + Vibration can not cancel during pattern is working "Vibration cannot be canceled during pattern vibration" > LayoutTests/ChangeLog:8 > + Add a test case for cancel vibtion during pattern vibration is working. "cancel vibtion during pattern vibration is working" -> "vibration cancellation during pattern vibration." > LayoutTests/ChangeLog:9 > + In addition, restore visibilityState before excuting cancelVibration-after-pagevisibility-changed-to-hidden.html. "executing"
Kihong Kwon
Comment 6 2013-06-26 04:49:47 PDT
Gyuyoung Kim
Comment 7 2013-06-26 05:04:48 PDT
Comment on attachment 205470 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=205470&action=review >> m_pattern is cleared in the cancelVibration but suspenVibration need to add left time to the pattern. therefore It's little bit different. How about adding new private function in order to process this logic ? m_timerStart.stop(); m_timerStop.stop(); m_vibrationClient->cancelVibration(); m_isVibrating = false; > Source/WebCore/ChangeLog:8 > + Vibration can not cancel during pattern vibration is working. If resting time which are Still can not -> cannot.
Chris Dumez
Comment 8 2013-06-26 05:10:09 PDT
Comment on attachment 205470 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=205470&action=review >> Source/WebCore/ChangeLog:8 >> + Vibration can not cancel during pattern vibration is working. If resting time which are > > Still can not -> cannot. Technically I believe both are valid. I agree that 'cannot' seems more commonly used though.
Kihong Kwon
Comment 9 2013-06-26 05:27:17 PDT
(In reply to comment #7) > (From update of attachment 205470 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=205470&action=review > > >> m_pattern is cleared in the cancelVibration but suspenVibration need to add left time to the pattern. therefore It's little bit different. > > How about adding new private function in order to process this logic ? > > m_timerStart.stop(); > m_timerStop.stop(); > m_vibrationClient->cancelVibration(); > m_isVibrating = false; > No problem. Thanks chris and gyuyoung. :)
Kihong Kwon
Comment 10 2013-06-26 05:33:24 PDT
Gyuyoung Kim
Comment 11 2013-06-26 05:36:55 PDT
Comment on attachment 205478 [details] Patch LGTM. Please land after finishing all ews.
WebKit Commit Bot
Comment 12 2013-06-26 19:01:18 PDT
Comment on attachment 205478 [details] Patch Clearing flags on attachment: 205478 Committed r152070: <http://trac.webkit.org/changeset/152070>
WebKit Commit Bot
Comment 13 2013-06-26 19:01:22 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.