Closed Bug 858454 Opened 12 years ago Closed 12 years ago

mozKeyboard.sendKey takes more than 10ms

Categories

(Firefox OS Graveyard :: Gaia::Keyboard, defect)

ARM
All
defect
Not set
normal

Tracking

(firefox21 wontfix, firefox22 wontfix, firefox23 fixed, b2g18 fixed, b2g18-v1.0.0 wontfix, b2g18-v1.0.1 wontfix)

RESOLVED FIXED
B2G C4 (2jan on)
Tracking Status
firefox21 --- wontfix
firefox22 --- wontfix
firefox23 --- fixed
b2g18 --- fixed
b2g18-v1.0.0 --- wontfix
b2g18-v1.0.1 --- wontfix

People

(Reporter: vingtetun, Assigned: gal)

References

Details

Attachments

(1 file, 3 obsolete files)

Calling mozKeyboard.sendKey cost a bit more than 10ms in the click method of the latin.js. This is likely before a call to this API fire synchronously 3 calls to nsIDOMWindowUtils.sendKeyEvent that triggers a widget->dispatchEvent. I don't know if those calls are synced or not? A simple "fix" is to wrap the API call into a setTimeout(..., 0) so it does not block user actions and will be postpone when there is some times on the event loop. A smarter fix could be to do that inside the mozKeyboard.sendKey code. The right fix involves understanding is widget->dispatchEvent is sync or not and in this case I still believe that setTimeout(..., 0) is not that bad.The main issue here being that the keyboard lives on the main thread and the mozKeyboard api is not e10s ready.
Yep, those calls are sync because they return whether you took the default action.
Assignee: nobody → gal
Attachment #734290 - Flags: review?(fabrice)
Attachment #734290 - Flags: review?(21)
Please steal and land when you r+. Thanks!
Comment on attachment 734290 [details] [diff] [review] send keyboard events from the event loop, one by one, to avoid hogging the event loop for too long Review of attachment 734290 [details] [diff] [review]: ----------------------------------------------------------------- lgtm, but I did not run any timing to check if we get the improvements we expect.
Attachment #734290 - Flags: review?(fabrice) → review+
Attachment #734290 - Attachment is obsolete: true
Attachment #734290 - Flags: review?(21)
Attachment #734341 - Flags: review+
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Comment on attachment 734341 [details] [diff] [review] tested version with a few fixes, carrying forward r=fabrice I tested this on device and this definitely feels more performant so I think we should take this for v1.1
Attachment #734341 - Flags: approval-gaia-v1+
Whiteboard: checkin-needed
Blocks: 835404
I assume that was meant to be an approval-b2g18?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: