Closed Bug 2021345 Opened 4 months ago Closed 3 months ago

Move WebSerial reads to a separate thread for performance/power reasons

Categories

(Core :: DOM: Web Serial, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
152 Branch
Tracking Status
firefox151 --- fixed
firefox152 --- fixed

People

(Reporter: gstoll, Assigned: gstoll)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Right now in dom/webserial/SerialPlatformRunnable.cpp we poll the serial port device and redispatch fairly frequently (at time of writing kReadPollIntervalMs is 20) to avoid missing data. If we moved this to a separate thread for each device, we could instead just block the thread, similar to what Chromium does.

Blocks: webserial
Depends on: 2031881
Blocks: 2032667
Assignee: nobody → gstoll
Attachment #9570687 - Attachment description: WIP: Bug 2021345 - make WebSerial reads asynchronous → Bug 2021345 - make WebSerial reads asynchronous r=nika!
Status: NEW → ASSIGNED
Blocks: 2026743
No longer blocks: webserial
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 152 Branch

firefox-beta Uplift Approval Request

  • User impact if declined/Reason for urgency: poor performance for reading from WebSerial devices
  • Code covered by automated testing?: yes
  • Fix verified in Nightly?: no
  • Needs manual QE testing?: no
  • Steps to reproduce for manual QE testing: n/a
  • Risk associated with taking this patch: low
  • Explanation of risk level: Reworks how we read from WebSerial devices, but should only affects those devices and we've done manual validation for the most common ones.
  • String changes made/needed?: n/a
  • Is Android affected?: no
Attachment #9575262 - Flags: approval-mozilla-beta?

Note that this relies on the new PlatformPipeReader class added for
bug 2031881. Using this and NS_AsyncCopy() means that we no longer have
to poll for new data from serial devices, which means we're faster to
receive that data and also yields better power usage.

Original Revision: https://phabricator.services.mozilla.com/D294690

Attachment #9575262 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Regressions: 2040754
Component: DOM: Device Interfaces → Dom: Web Serial
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: