Closed Bug 1412189 Opened 2 years ago Closed 2 years ago

Avoid main-thread access in PrioritizedEventQueue::SelectQueue

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: billm, Assigned: billm)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
This is basically a re-do of bug 1398417. I realized that SelectQueue is called by HasReadyEvent, which is supposed to work from any thread (not just the main thread). But SelectQueue calls GetInputHandlingStartTime, which calls nsRefreshDriver::GetNextTickHint, which is main-thread only.

So I decided that it would be better to take the other approach from bug 1398417: to avoid updating mInputHandlingStartTime from SelectQueue.

This does mean that GetEvent and will work slightly differently from HasReadyEvent. However, I can't think of any reason why that would actually be a problem.

Note that if all queues except the input queue are empty, we will still process input events even if mInputHandlingStartTime.IsNull():
http://searchfox.org/mozilla-central/rev/00fa5dacedb925022f53d025121f1a919508e7ce/xpcom/threads/PrioritizedEventQueue.cpp#168
Attachment #8922627 - Flags: review?(sshih)
Comment on attachment 8922627 [details] [diff] [review]
patch

Review of attachment 8922627 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM, thanks.
Attachment #8922627 - Flags: review?(sshih) → review+
Pushed by wmccloskey@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/764e854bb9b3
Avoid main-thread access in PrioritizedEventQueue::SelectQueue (r=stone)
https://hg.mozilla.org/mozilla-central/rev/764e854bb9b3
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in before you can comment on or make changes to this bug.