Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1714)

Unified Diff: Source/modules/vibration/NavigatorVibration.cpp

Issue 18478003: Vibration cannot be canceled during pattern vibration. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/vibration/NavigatorVibration.cpp
diff --git a/Source/modules/vibration/NavigatorVibration.cpp b/Source/modules/vibration/NavigatorVibration.cpp
index 194b2593818eb008b1ce4ac0d3818c0012944800..400395e5063b5bfa4e32b04713bacc5b7d393e35 100644
--- a/Source/modules/vibration/NavigatorVibration.cpp
+++ b/Source/modules/vibration/NavigatorVibration.cpp
@@ -84,6 +84,7 @@ bool NavigatorVibration::vibrate(const VibrationPattern& pattern)
}
m_timerStart.startOneShot(0);
+ m_isVibrating = true;
return true;
}
@@ -112,6 +113,7 @@ void NavigatorVibration::resumeVibration()
ASSERT(!m_timerStart.isActive());
m_timerStart.startOneShot(0);
+ m_isVibrating = true;
}
void NavigatorVibration::timerStartFired(Timer<NavigatorVibration>* timer)
@@ -119,7 +121,6 @@ void NavigatorVibration::timerStartFired(Timer<NavigatorVibration>* timer)
ASSERT_UNUSED(timer, timer == &m_timerStart);
if (m_pattern.size()) {
- m_isVibrating = true;
WebKit::Platform::current()->vibrate(m_pattern[0]);
m_timerStop.startOneShot(m_pattern[0] / 1000.0);
m_pattern.remove(0);
@@ -130,11 +131,11 @@ void NavigatorVibration::timerStopFired(Timer<NavigatorVibration>* timer)
{
ASSERT_UNUSED(timer, timer == &m_timerStop);
- m_isVibrating = false;
Michael van Ouwerkerk 2013/07/03 10:47:55 I think you want to keep this line, but make it co
kihong 2013/07/08 10:14:06 Done.
-
if (m_pattern.size()) {
m_timerStart.startOneShot(m_pattern[0] / 1000.0);
m_pattern.remove(0);
+ if (m_pattern.isEmpty())
Michael van Ouwerkerk 2013/07/03 10:47:55 How would this ever happen? It should not, since t
kihong 2013/07/08 10:14:06 Done.
+ m_isVibrating = false;
}
}

Powered by Google App Engine
This is Rietveld 408576698