WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
130059
Refactor Vibration algorithm to use only one timer.
https://bugs.webkit.org/show_bug.cgi?id=130059
Summary
Refactor Vibration algorithm to use only one timer.
Jinwoo Jeong
Reported
2014-03-10 18:12:44 PDT
Currently Vibration has used two timers, But they does not work in same time. And in Vibration, there are some difference between algorithm defined in specification and implementation.
Attachments
Patch
(10.54 KB, patch)
2014-03-10 18:34 PDT
,
Jinwoo Jeong
no flags
Details
Formatted Diff
Diff
Patch
(10.75 KB, patch)
2014-03-11 01:49 PDT
,
Jinwoo Jeong
no flags
Details
Formatted Diff
Diff
Patch
(10.69 KB, patch)
2014-03-11 22:54 PDT
,
Jinwoo Jeong
no flags
Details
Formatted Diff
Diff
Patch
(10.66 KB, patch)
2014-03-11 23:03 PDT
,
Jinwoo Jeong
no flags
Details
Formatted Diff
Diff
Patch
(10.66 KB, patch)
2014-03-13 18:24 PDT
,
Jinwoo Jeong
no flags
Details
Formatted Diff
Diff
Patch
(10.65 KB, patch)
2014-03-13 18:28 PDT
,
Jinwoo Jeong
no flags
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Jinwoo Jeong
Comment 1
2014-03-10 18:34:16 PDT
Created
attachment 226363
[details]
Patch
Jinwoo Song
Comment 2
2014-03-10 19:29:59 PDT
Comment on
attachment 226363
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=226363&action=review
> Source/WebCore/ChangeLog:3 > + Refactor Vibration algorithm to use only 1 timer.
nit: s/1/one
> Source/WebCore/ChangeLog:8 > + Currently Vibration has used 2 timer,
Writing suggestion: 'Currently Vibration is using two timers,'
> Source/WebCore/ChangeLog:13 > + Indeed this patch applies the algorithm and restrictions defined on specification.
Writing suggestion: 'Also, this patch implement the missing part of the algorithm, which check the maximum length of the vibration pattern and the maximum duration of the vibration.
> Source/WebCore/Modules/vibration/Vibration.cpp:32 > +const unsigned MaxVibrationDuration = 10000;
Where these magic values come from?
> Source/WebCore/Modules/vibration/Vibration.cpp:87 > return true;
These lines can be removed as it is already checked.
> Source/WebCore/Modules/vibration/Vibration.cpp:110 > + m_state = Idle;
You may return here.
> Source/WebCore/Modules/vibration/Vibration.cpp:111 > + else {
Why don't you use switch-case statement here?
> Source/WebCore/Modules/vibration/Vibration.h:-45 > - // FIXME : Add suspendVibration() and resumeVibration() to the page visibility feature, when the document.hidden attribute is changed.
It's okay to remove these unused methods but It would be better to comment 'FIXME' for implementing page visibility feature.
Darin Adler
Comment 3
2014-03-11 00:32:33 PDT
Comment on
attachment 226363
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=226363&action=review
> Source/WebCore/Modules/vibration/Vibration.cpp:72 > + for (size_t i = 0; i < length; ++i) { > + if (sanitized[i] > MaxVibrationDuration) > + sanitized[i] = MaxVibrationDuration; > + }
I suggest writing it like this: for (auto& duration : sanitized) duration = std::min(duration, MaxVibrationDuration);
Jinwoo Jeong
Comment 4
2014-03-11 01:28:40 PDT
> > Source/WebCore/Modules/vibration/Vibration.cpp:32 > > +const unsigned MaxVibrationDuration = 10000; > > Where these magic values come from?
I referred to blink. And others is done.
Jinwoo Jeong
Comment 5
2014-03-11 01:49:17 PDT
Created
attachment 226397
[details]
Patch
Jinwoo Jeong
Comment 6
2014-03-11 22:54:52 PDT
Created
attachment 226476
[details]
Patch
Jinwoo Jeong
Comment 7
2014-03-11 23:03:43 PDT
Created
attachment 226477
[details]
Patch
Darin Adler
Comment 8
2014-03-13 10:56:27 PDT
Comment on
attachment 226477
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=226477&action=review
> Source/WebCore/Modules/vibration/Vibration.cpp:72 > + // Pre-exsiting instance need to be canceled when vibrate() is called.
Typo: "exsiting".
> Source/WebCore/Modules/vibration/Vibration.h:43 > + // FIXME : When visibilitychange event is dispatched, if a vibration is working, it should be canceled.
No space before the ":" in "FIXME:". I don’t understand the meaning of the phrase “a vibration is working”.
> Source/WebCore/Modules/vibration/Vibration.h:58 > + enum class State { > + Idle, > + Vibrating, > + Waiting > + };
I’d suggest putting this on a single line instead of 5 lines.
Jinwoo Jeong
Comment 9
2014-03-13 18:24:33 PDT
Created
attachment 226636
[details]
Patch
Jinwoo Jeong
Comment 10
2014-03-13 18:28:57 PDT
Created
attachment 226637
[details]
Patch
Jinwoo Jeong
Comment 11
2014-03-13 18:37:52 PDT
(In reply to
comment #8
)
> (From update of
attachment 226477
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=226477&action=review
> > > Source/WebCore/Modules/vibration/Vibration.cpp:72 > > + // Pre-exsiting instance need to be canceled when vibrate() is called. > > Typo: "exsiting". > > > Source/WebCore/Modules/vibration/Vibration.h:43 > > + // FIXME : When visibilitychange event is dispatched, if a vibration is working, it should be canceled. > > No space before the ":" in "FIXME:". > > I don’t understand the meaning of the phrase “a vibration is working”. > > > Source/WebCore/Modules/vibration/Vibration.h:58 > > + enum class State { > > + Idle, > > + Vibrating, > > + Waiting > > + }; > > I’d suggest putting this on a single line instead of 5 lines.
Applied Darin's comment.
WebKit Commit Bot
Comment 12
2014-03-13 19:50:25 PDT
Comment on
attachment 226637
[details]
Patch Clearing flags on attachment: 226637 Committed
r165598
: <
http://trac.webkit.org/changeset/165598
>
WebKit Commit Bot
Comment 13
2014-03-13 19:50:32 PDT
All reviewed patches have been landed. Closing bug.
8179.jeong@gmail.com
Comment 14
2014-03-13 20:51:53 PDT
***
Bug 129598
has been marked as a duplicate of this bug. ***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug