Bug 1799495 - Ensure WaitForShmem has a valid DrawTargetWebgl to access. r=aosmond

Differential Revision: https://phabricator.services.mozilla.com/D161554
This commit is contained in:
Lee Salzman
2022-11-08 16:23:56 +00:00
parent 2385408a70
commit 35c8c81b94
4 changed files with 28 additions and 5 deletions

View File

@@ -224,7 +224,7 @@ DrawTargetWebgl::~DrawTargetWebgl() {
// Force any Skia snapshots to copy the shmem before it deallocs.
mSkia->DetachAllSnapshots();
// Ensure we're done using the shmem before dealloc.
mSharedContext->WaitForShmem();
mSharedContext->WaitForShmem(this);
auto* child = mSharedContext->mWebgl->GetChild();
if (child && child->CanSend()) {
child->DeallocShmem(mShmem);
@@ -3226,7 +3226,7 @@ void DrawTargetWebgl::FillGlyphs(ScaledFont* aFont, const GlyphBuffer& aBuffer,
mSkia->FillGlyphs(aFont, aBuffer, aPattern, aOptions);
}
void DrawTargetWebgl::SharedContext::WaitForShmem() {
void DrawTargetWebgl::SharedContext::WaitForShmem(DrawTargetWebgl* aTarget) {
if (mWaitForShmem) {
// GetError is a sync IPDL call that forces all dispatched commands to be
// flushed. Once it returns, we are certain that any commands processing
@@ -3235,7 +3235,9 @@ void DrawTargetWebgl::SharedContext::WaitForShmem() {
mWaitForShmem = false;
// The sync IPDL call can cause expensive round-trips to add up over time,
// so account for that here.
mCurrentTarget->mProfile.OnReadback();
if (aTarget) {
aTarget->mProfile.OnReadback();
}
}
}