Closed Bug 1391865 Opened 3 years ago Closed 3 years ago

Use same PBackgroundChild for all cooperative threads

Categories

(Core :: IPC, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: billm, Assigned: billm)

References

Details

Attachments

(1 file)

Attached patch patchSplinter Review
Originally we talked about using one PBackgroundChild actor for each cooperative thread. However, this won't work. All the cooperative threads share a single event queue. Suppose that one PBackgroundChild sent a message to the background thread. It might be received on a different cooperative thread, which would have a different PBackgroundChild stored in its TLS. Even if we made it work, it would be very confusing.

This patch makes us use a single PBackgroundChild actor for all the main threads. It does so by storing the PBackgroundChild actor for the main thread in a global variable instead of in TLS.
Attachment #8899030 - Flags: review?(btseng)
Comment on attachment 8899030 [details] [diff] [review]
patch

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

::: ipc/glue/BackgroundImpl.cpp
@@ +1603,5 @@
>  // static
>  void
>  ChildImpl::CloseForCurrentThread()
>  {
> +  MOZ_ASSERT(!NS_IsMainThread());

nit:
MOZ_ASSERT(!NS_IsMainThread(), "The TLS on the main thread shall always be closed from ChildImpl::Shutdown().");
Attachment #8899030 - Flags: review?(btseng) → review+
Pushed by wmccloskey@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/f7ed5293a8cd
Use same PBackground for all cooperative threads (r=bevis)
https://hg.mozilla.org/mozilla-central/rev/f7ed5293a8cd
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.