The default bug view has changed. See this FAQ.

coalesce the device motion events

RESOLVED FIXED in mozilla14

Status

()

Core
Geolocation
RESOLVED FIXED
5 years ago
2 years ago

People

(Reporter: dougt, Assigned: dougt)

Tracking

unspecified
mozilla14
x86
Mac OS X
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
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

5 years ago
Created attachment 604421 [details] [diff] [review]
patch v.1
Attachment #604421 - Flags: review?(josh)

Comment 2

5 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+
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
Re-landed and merged:
https://hg.mozilla.org/mozilla-central/rev/ed1d52905a61
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14
Depends on: 1010124
Depends on: 1095867
You need to log in before you can comment on or make changes to this bug.