Closed Bug 1634253 Opened 5 years ago Closed 5 years ago

Stop the CompositorThreadHolder from using ipc's MessageLoop and ipc::base::Thread

Categories

(Core :: Graphics, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox78 --- fixed

People

(Reporter: jya, Assigned: jya)

References

(Blocks 1 open bug)

Details

Attachments

(9 files)

There's really no good reason to use a MessageLoop or ipc::base::Thread; it's internally creating a thread via the same methods as your typical nsThread.

It brings no benefit and requires unnecessarily the ipc::MessageLoop::SerialEventTarget() whenever we need to work with MozPromise.

It's also get in the way of properly fixing bug 1592488

Blocks: 1634254
Priority: -- → P3
Severity: -- → normal
Blocks: 1260828
Assignee: nobody → jyavenard

This will allow to have other threads to use one such as the compositor thread.

Depends on D73819

already_AddRefed destructor assert that it's nullptr.
DelayedDispatch check that the value passed isn't 0 and return an error code, leaving the already_AddRefed untouched.

Depends on D73820

CompositorBridgeParent::ScheduleTask is always called from the compositor thread ; so make it explicit that we are dispatching the task to the compositor thread.

We make the method private and non-virtual as it's how it's actually used.

Depends on D73823

We re-enable the option to have a BackgroundHangMonitor on the compositor thread that was removed earlier..

Depends on D73825

MessagePool brings no benefit over the traditional nsIThread.

Additonally, replace some incorrect use of RefPtr for xpcom objects.

Depends on D73826

(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #2)

More so a dupe of bug 1259450

I only see this comment now.

This list of patch pretty much covers everything listed in bug 1259450 comment 1.

There's no longer a MessageLoop running in the compositor thread (if you exclude the nsThread code that always creates a MessageLoop anyway).
You can no longer dispatch tasks to it.

The CompositorThread is now a nsISerialEventTarget (nsThread internally)

Pushed by jyavenard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6fac93b596c2 P1. Fix constness. r=froydnj https://hg.mozilla.org/integration/autoland/rev/8865de9ae0ef P2. Dissociate running a BackgroundHangMonitor from main thread. r=froydnj https://hg.mozilla.org/integration/autoland/rev/6e47af64396a P3. Don't cause assertion when delay is 0. r=froydnj https://hg.mozilla.org/integration/autoland/rev/dc7e17f772be P4. Have NS_NewNamedThread take a already_Refed<nsIRunnable. r=froydnj https://hg.mozilla.org/integration/autoland/rev/5c0b7aa99406 P5. Make threading model clearer. r=kats https://hg.mozilla.org/integration/autoland/rev/e3acd9db7065 P6. Remove MessageLoop use from gfx. r=kats,mattwoodrow https://hg.mozilla.org/integration/autoland/rev/53fd00dcf95c P7. Re-enable BackgroundHangMonitor on Compositor thread. r=froydnj https://hg.mozilla.org/integration/autoland/rev/1cbb2866a3ad P8. Remove use of MessageLoop in Canvas. r=mattwoodrow
See Also: → 1635001

The test is a permafail without any of those changes on all my windows machine so I've been unable to diagnostic what could happen.

According to :kats, the test was never rewritten to use the new APZ. Disabling on the platform where there's high intermittent failure (about 70%)

Pushed by jyavenard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/139e7035e736 P1. Fix constness. r=froydnj https://hg.mozilla.org/integration/autoland/rev/fa3e7588e7d6 P2. Dissociate running a BackgroundHangMonitor from main thread. r=froydnj https://hg.mozilla.org/integration/autoland/rev/ea62cb1ec472 P3. Don't cause assertion when delay is 0. r=froydnj https://hg.mozilla.org/integration/autoland/rev/9f01acdf4367 P4. Have NS_NewNamedThread take a already_Refed<nsIRunnable. r=froydnj https://hg.mozilla.org/integration/autoland/rev/855e222ceb14 P5. Make threading model clearer. r=kats https://hg.mozilla.org/integration/autoland/rev/e98212a74709 P6. Remove MessageLoop use from gfx. r=kats,mattwoodrow https://hg.mozilla.org/integration/autoland/rev/43eda078b405 P7. Re-enable BackgroundHangMonitor on Compositor thread. r=froydnj https://hg.mozilla.org/integration/autoland/rev/5f8a1ee17b81 P8. Remove use of MessageLoop in Canvas. r=mattwoodrow https://hg.mozilla.org/integration/autoland/rev/d41b75c1f7ec P9. Disable intermittently failing test on win64 debug. r=Gijs
Attachment #9146746 - Attachment description: Bug 1634253 - P9. Disable intermittently failing test on win64 debug. r?Gijs → Bug 1634253 - P9. Disable intermittently failing test on win64 debug and asan. r?Gijs
Pushed by jyavenard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/802f45438017 P1. Fix constness. r=froydnj https://hg.mozilla.org/integration/autoland/rev/0a19ecda120c P2. Dissociate running a BackgroundHangMonitor from main thread. r=froydnj https://hg.mozilla.org/integration/autoland/rev/dff108315979 P3. Don't cause assertion when delay is 0. r=froydnj https://hg.mozilla.org/integration/autoland/rev/366e40b91676 P4. Have NS_NewNamedThread take a already_Refed<nsIRunnable. r=froydnj https://hg.mozilla.org/integration/autoland/rev/eef89c57b57a P5. Make threading model clearer. r=kats https://hg.mozilla.org/integration/autoland/rev/728ba655194f P6. Remove MessageLoop use from gfx. r=kats,mattwoodrow https://hg.mozilla.org/integration/autoland/rev/091a01b12001 P7. Re-enable BackgroundHangMonitor on Compositor thread. r=froydnj https://hg.mozilla.org/integration/autoland/rev/426e7df37812 P8. Remove use of MessageLoop in Canvas. r=mattwoodrow https://hg.mozilla.org/integration/autoland/rev/33d3d4104e46 P9. Disable intermittently failing test on win64 debug and asan. r=Gijs
Flags: needinfo?(jyavenard)

https://hg.mozilla.org/integration/autoland/rev/728ba655194f dropped a call to ClearAllCaches was that intentional?

Flags: needinfo?(jyavenard)
Regressions: 1639388
Flags: needinfo?(jyavenard)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: