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:
@@ -224,7 +224,7 @@ DrawTargetWebgl::~DrawTargetWebgl() {
|
|||||||
// Force any Skia snapshots to copy the shmem before it deallocs.
|
// Force any Skia snapshots to copy the shmem before it deallocs.
|
||||||
mSkia->DetachAllSnapshots();
|
mSkia->DetachAllSnapshots();
|
||||||
// Ensure we're done using the shmem before dealloc.
|
// Ensure we're done using the shmem before dealloc.
|
||||||
mSharedContext->WaitForShmem();
|
mSharedContext->WaitForShmem(this);
|
||||||
auto* child = mSharedContext->mWebgl->GetChild();
|
auto* child = mSharedContext->mWebgl->GetChild();
|
||||||
if (child && child->CanSend()) {
|
if (child && child->CanSend()) {
|
||||||
child->DeallocShmem(mShmem);
|
child->DeallocShmem(mShmem);
|
||||||
@@ -3226,7 +3226,7 @@ void DrawTargetWebgl::FillGlyphs(ScaledFont* aFont, const GlyphBuffer& aBuffer,
|
|||||||
mSkia->FillGlyphs(aFont, aBuffer, aPattern, aOptions);
|
mSkia->FillGlyphs(aFont, aBuffer, aPattern, aOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawTargetWebgl::SharedContext::WaitForShmem() {
|
void DrawTargetWebgl::SharedContext::WaitForShmem(DrawTargetWebgl* aTarget) {
|
||||||
if (mWaitForShmem) {
|
if (mWaitForShmem) {
|
||||||
// GetError is a sync IPDL call that forces all dispatched commands to be
|
// GetError is a sync IPDL call that forces all dispatched commands to be
|
||||||
// flushed. Once it returns, we are certain that any commands processing
|
// flushed. Once it returns, we are certain that any commands processing
|
||||||
@@ -3235,7 +3235,9 @@ void DrawTargetWebgl::SharedContext::WaitForShmem() {
|
|||||||
mWaitForShmem = false;
|
mWaitForShmem = false;
|
||||||
// The sync IPDL call can cause expensive round-trips to add up over time,
|
// The sync IPDL call can cause expensive round-trips to add up over time,
|
||||||
// so account for that here.
|
// so account for that here.
|
||||||
mCurrentTarget->mProfile.OnReadback();
|
if (aTarget) {
|
||||||
|
aTarget->mProfile.OnReadback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ class DrawTargetWebgl : public DrawTarget, public SupportsWeakPtr {
|
|||||||
void ClearEmptyTextureMemory();
|
void ClearEmptyTextureMemory();
|
||||||
void ClearCachesIfNecessary();
|
void ClearCachesIfNecessary();
|
||||||
|
|
||||||
void WaitForShmem();
|
void WaitForShmem(DrawTargetWebgl* aTarget);
|
||||||
};
|
};
|
||||||
|
|
||||||
RefPtr<SharedContext> mSharedContext;
|
RefPtr<SharedContext> mSharedContext;
|
||||||
@@ -486,7 +486,7 @@ class DrawTargetWebgl : public DrawTarget, public SupportsWeakPtr {
|
|||||||
|
|
||||||
void WaitForShmem() {
|
void WaitForShmem() {
|
||||||
if (mSharedContext->mWaitForShmem) {
|
if (mSharedContext->mWaitForShmem) {
|
||||||
mSharedContext->WaitForShmem();
|
mSharedContext->WaitForShmem(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
20
gfx/tests/crashtests/1799495-1.html
Normal file
20
gfx/tests/crashtests/1799495-1.html
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script>
|
||||||
|
window.addEventListener('load', async () => {
|
||||||
|
const canvas1 = document.createElement('canvas')
|
||||||
|
document.documentElement.appendChild(canvas1)
|
||||||
|
const context1 = canvas1.getContext('2d')
|
||||||
|
context1.globalCompositeOperation = 'destination-atop'
|
||||||
|
const path = new Path2D()
|
||||||
|
context1.fill(path, 'nonzero')
|
||||||
|
const canvas2 = document.createElement('canvas')
|
||||||
|
const context2 = canvas2.getContext('2d', {})
|
||||||
|
await window.createImageBitmap(canvas1, 124, 233, 2147483647, 1, {})
|
||||||
|
context2.filter = 'invert( 90% )'
|
||||||
|
context2.fillRect(-1, -128, 4096, 1024)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
</html>
|
||||||
@@ -222,3 +222,4 @@ pref(layout.css.backdrop-filter.enabled,true) load 1771561.html
|
|||||||
load 1780567.html
|
load 1780567.html
|
||||||
load 1681955.html
|
load 1681955.html
|
||||||
load 1797099-1.html
|
load 1797099-1.html
|
||||||
|
load 1799495-1.html
|
||||||
|
|||||||
Reference in New Issue
Block a user