Closed Bug 1647958 Opened 4 years ago Closed 4 years ago

GetCurrentThreadSerialEventTarget() doesn't return what you expect (part 2)

Categories

(Core :: XPCOM, task)

task

Tracking

()

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: jya, Assigned: jya)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

In bug 1637500 we made sure that GetCurrentSerialEventTarget returned the properly value with:

  • TaskQueue
  • STS
  • XPCOMThreadWrapper/AbstractThread

We had a pending P5 change that made the DocGroup's serial event target being returned however, as mentioned by :nika we want to keep returning the actual main thread.

We also covered the MessageLoop::EventTarget; however, we want to return the actual XPCOM nsThread if used by the MessageLoop.

In the case where the MessageLoop doesn't have a XPCOM nsThread; we wants to return the MessageLoop's EventTarget.
This will also cover cases where in process with XPCOM not initilised (such as GMP); GetCurrentSerialEventTarget will return a non-null value.

EventTarget::Dispatch can be called on any threads ; there's a potential of a race when accessing the mLoop member.

It can be used to wrap a Runnable and set the CurrentSerialEventTarget TLS for the duration of the runnable's run and so that it returns the right value when called.

We want it to returning the actual nsThread if that's where the MessageLoop would dispatch its tasks; otherwise return the MessageLoop's EventTarget

Depends on D80357

Pushed by jyavenard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/af210e0df79f P1. Protects MessageLoop::EventTarget's mLoop member. r=nika https://hg.mozilla.org/integration/autoland/rev/55ecb48a0504 P3. Have GetCurrentSerialEventTarget returns the currently running MessageLoop. r=nika
Pushed by jyavenard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1080acf92cfc P1. Protects MessageLoop::EventTarget's mLoop member. r=nika https://hg.mozilla.org/integration/autoland/rev/9a07058c8c33 P3. Have GetCurrentSerialEventTarget returns the currently running MessageLoop. r=nika
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80
Flags: needinfo?(jyavenard)
Blocks: 1649685
Attachment #9158792 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: