forked from mirrors/gecko-dev
Bug 1870970 - Ensure we call DrawEventRecorder::DetachResources to avoid memory leaks. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D196936
This commit is contained in:
parent
1b7e49f639
commit
40d33b8232
2 changed files with 12 additions and 2 deletions
|
|
@ -152,6 +152,7 @@ PaintFragment PaintFragment::Record(dom::BrowsingContext* aBc,
|
|||
}
|
||||
|
||||
if (!recorder->mOutputStream.mValid) {
|
||||
recorder->DetachResources();
|
||||
return PaintFragment{};
|
||||
}
|
||||
|
||||
|
|
@ -162,11 +163,14 @@ PaintFragment PaintFragment::Record(dom::BrowsingContext* aBc,
|
|||
recorder->mOutputStream.mLength = 0;
|
||||
recorder->mOutputStream.mCapacity = 0;
|
||||
|
||||
return PaintFragment{
|
||||
PaintFragment fragment{
|
||||
surfaceSize.ToUnknownSize(),
|
||||
std::move(recording),
|
||||
std::move(recorder->TakeDependentSurfaces()),
|
||||
};
|
||||
|
||||
recorder->DetachResources();
|
||||
return fragment;
|
||||
}
|
||||
|
||||
bool PaintFragment::IsEmpty() const {
|
||||
|
|
@ -323,7 +327,7 @@ CrossProcessPaint::CrossProcessPaint(float aScale, dom::TabId aRoot,
|
|||
CrossProcessPaintFlags aFlags)
|
||||
: mRoot{aRoot}, mScale{aScale}, mPendingFragments{0}, mFlags{aFlags} {}
|
||||
|
||||
CrossProcessPaint::~CrossProcessPaint() = default;
|
||||
CrossProcessPaint::~CrossProcessPaint() { Clear(NS_ERROR_ABORT); }
|
||||
|
||||
void CrossProcessPaint::ReceiveFragment(dom::WindowGlobalParent* aWGP,
|
||||
PaintFragment&& aFragment) {
|
||||
|
|
|
|||
|
|
@ -125,6 +125,12 @@ nsDeviceContextSpecProxy::EndDocument() {
|
|||
|
||||
Unused << mRemotePrintJob->SendFinalizePrint();
|
||||
|
||||
if (mRecorder) {
|
||||
MOZ_ASSERT(!mRecorder->IsOpen());
|
||||
mRecorder->DetachResources();
|
||||
mRecorder = nullptr;
|
||||
}
|
||||
|
||||
return mozilla::gfx::PrintEndDocumentPromise::CreateAndResolve(true,
|
||||
__func__);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue