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

Side by Side Diff: third_party/WebKit/Source/modules/vibration/VibrationController.cpp

Issue 2191533003: Refactor Timer classes in preparation for landing FrameTimers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 // This may be a bit racy with |didCancel| being called as a mojo callback, 107 // This may be a bit racy with |didCancel| being called as a mojo callback,
108 // it also starts the timer. This is not a problem as calling |startOneShot| 108 // it also starts the timer. This is not a problem as calling |startOneShot|
109 // repeatedly will just update the time at which to run |doVibrate|, it will 109 // repeatedly will just update the time at which to run |doVibrate|, it will
110 // not be called more than once. 110 // not be called more than once.
111 m_timerDoVibrate.startOneShot(0, BLINK_FROM_HERE); 111 m_timerDoVibrate.startOneShot(0, BLINK_FROM_HERE);
112 112
113 return true; 113 return true;
114 } 114 }
115 115
116 void VibrationController::doVibrate(Timer<VibrationController>* timer) 116 void VibrationController::doVibrate(TimerBase* timer)
117 { 117 {
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) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 PageVisibilityObserver::trace(visitor); 203 PageVisibilityObserver::trace(visitor);
204 } 204 }
205 205
206 } // namespace blink 206 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698