Closed
Bug 734391
Opened 14 years ago
Closed 14 years ago
coalesce the device motion events
Categories
(Core :: DOM: Geolocation, defect)
Tracking
()
RESOLVED
FIXED
mozilla14
People
(Reporter: dougt, Assigned: dougt)
References
Details
Attachments
(1 file)
|
8.62 KB,
patch
|
jdm
:
review+
|
Details | Diff | Splinter Review |
We can improve perf a bit by not sending 3 separate dom events. Instead, we can coalesce the device motion events by waiting a bit to see if there is additional motion data before posting the dom event.
| Assignee | ||
Comment 1•14 years ago
|
||
Attachment #604421 -
Flags: review?(josh)
Comment 2•14 years ago
|
||
Comment on attachment 604421 [details] [diff] [review]
patch v.1
Review of attachment 604421 [details] [diff] [review]:
-----------------------------------------------------------------
r=me
::: dom/system/nsDeviceMotion.cpp
@@ +344,5 @@
> double x,
> double y,
> double z) {
> + // Attempt to coalesce events
> + bool fireEvent = false;
Just assign the result of the condition to fireEvent?
@@ +345,5 @@
> double y,
> double z) {
> + // Attempt to coalesce events
> + bool fireEvent = false;
> + if (PR_IntervalNow() > mLastDOMMotionEventTime + PR_MillisecondsToInterval(DEFAULT_SENSOR_POLL))
Let's use TimeStamp::Now() and TimeDuration::FromMilliseconds instead.
@@ +391,5 @@
> +
> + mLastRotationRate = nsnull;
> + mLastAccelerationIncluduingGravity = nsnull;
> + mLastAcceleration = nsnull;
> + mLastDOMMotionEventTime = PR_IntervalNow();
TimeStamp::Now()
::: dom/system/nsDeviceMotion.h
@@ +98,5 @@
> virtual void Startup() = 0;
> virtual void Shutdown() = 0;
> +
> + bool mEnabled;
> + PRIntervalTime mLastDOMMotionEventTime;
TimeStamp
Attachment #604421 -
Flags: review?(josh) → review+
Comment 3•14 years ago
|
||
Sorry, backed out for OS X M1/M3 oranges:
https://tbpl.mozilla.org/?tree=Mozilla-Inbound&rev=c619bbb2951f
https://tbpl.mozilla.org/php/getParsedLog.php?id=10039398&tree=Mozilla-Inbound
https://tbpl.mozilla.org/php/getParsedLog.php?id=10039239&tree=Mozilla-Inbound
https://hg.mozilla.org/integration/mozilla-inbound/rev/ec55dae77b79
Comment 4•14 years ago
|
||
Re-landed and merged:
https://hg.mozilla.org/mozilla-central/rev/ed1d52905a61
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14
You need to log in
before you can comment on or make changes to this bug.
Description
•