Closed Bug 1282343 Opened 8 years ago Closed 8 years ago

Clean up CompositorSession shutdown

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla50
Tracking Status
firefox50 --- fixed

People

(Reporter: dvander, Assigned: dvander)

References

Details

Attachments

(2 files, 1 obsolete file)

We don't ever explicitly release the last reference to CompositorBridgeParent - either nsBaseWidget will do it via its destructor, or CompositorBridgeParent::DeferredDestroy will do it if ~nsBaseWidget runs first.

I'd like to make this more explicit so it's totally clear that the compositor is no longer in use.
This spells out the behavior of how CompositorBridgeParent is destroyed, from the point of view of the CompositorSession. It also makes sure to null out any CompositorSession-related pointers in nsBaseWidget::DestroyCompositor().
Attachment #8765314 - Flags: review?(matt.woodrow)
Comment on attachment 8765314 [details] [diff] [review]
part 1, revoke all compositor pointers

kats, to make sure nulling out mAPZC is okay here.
Attachment #8765314 - Flags: review?(bugmail.mozilla)
Technically the compositor can still access the widget even though it may be gone. I don't think this actually happens, but we might as well null this out to be sure.
Attachment #8765315 - Flags: review?(matt.woodrow)
Attachment #8765314 - Flags: review?(matt.woodrow) → review+
Attachment #8765315 - Flags: review?(matt.woodrow) → review+
Comment on attachment 8765314 [details] [diff] [review]
part 1, revoke all compositor pointers

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

I'm not sure, to be honest. I read through my notes from the last time I had to go through the widget/compositor shutdown code [1] but I'm not sure when CompositorSession::Shutdown fits in that process. However, if it makes sense to do so, I would like to have mAPZC nulled out in the same place that we destroy the mRootContentController - so either do the nulling out in nsBaseWidget::OnDestroy, or move the existing mRootContentController code to nsBaseWidget::DestroyCompositor. I suspect the former is safer.

Also please check that opening and closing windows without shutting down the whole browser doesn't leak stuff (i.e. bug 1264161 doesn't regress) because we don't have any automated coverage for that scenario.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1264161#c25
kats, this patch factors the content controller step into a separate method, and calls it in both places to be safe. I also cleaned up the fail case of CreateCompositor() and added something of a comment explaining the shutdown sequence.

I'll test on OS X tonight to make sure that memory leak hasn't regressed.
Attachment #8765314 - Attachment is obsolete: true
Attachment #8765314 - Flags: review?(bugmail.mozilla)
Attachment #8765666 - Flags: review?(bugmail.mozilla)
Comment on attachment 8765666 [details] [diff] [review]
part 1, revoke all compositor pointers v2

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

Thanks, the comment is very useful!
Attachment #8765666 - Flags: review?(bugmail.mozilla) → review+
Pushed by danderson@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/0ac0b0b0968d
Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
https://hg.mozilla.org/integration/mozilla-inbound/rev/8896a11ad540
Revoke widget pointer from CompositorBridgeParent on shutdown. (bug 1282343 part 2, r=mattwoodrow)
https://hg.mozilla.org/mozilla-central/rev/0ac0b0b0968d
https://hg.mozilla.org/mozilla-central/rev/8896a11ad540
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: