Bug 1511493 - Ensure PushGlyphs uses the current transaction's IpcResourceUpdateQueue. r=emilio

WebRenderBridgeChild::GetFontKeyForScaledFont can currently cause a IpcResourceUpdateQueue race.
If we're in the middle of a transaction building a blob image, GetFontKeyForScaledFont is called
in the blob image building code using the transaction's IpcResourceUpdateQueue as expected, such
that resource updates are sent out when the transaction is finalized.

However, TextDrawTarget calls into PushGlyphs without passing along its IpcResourceUpdateQueue,
calling GetFontKeyForScaledFont without it, and causing it to immediately send out the resource
update.

So if a blob image uses a font key and submits a resource update, but a display list is built
after that also using the font key within the transaction, the display list will fail to send
the resource update because it thinks the blob image already did, even though the blob image
transaction has not yet been finalized.

The simple fix is to just pass IpcResourceUpdateQueue from TextDrawTarget into PushGlyphs, thus
ensuring the resource updates are properly ordered.

Differential Revision: https://phabricator.services.mozilla.com/D140438
This commit is contained in:
Lee Salzman
2022-03-05 23:35:16 +00:00
parent 9591bdd588
commit 51030f7ed6
8 changed files with 27 additions and 43 deletions

View File

@@ -628,8 +628,8 @@ struct DIGroup {
aStream.write((const char*)&count, sizeof(count));
for (auto& scaled : aScaledFonts) {
Maybe<wr::FontInstanceKey> key =
aWrManager->WrBridge()->GetFontKeyForScaledFont(
scaled, &aResources);
aWrManager->WrBridge()->GetFontKeyForScaledFont(scaled,
aResources);
if (key.isNothing()) {
validFonts = false;
break;
@@ -2396,8 +2396,8 @@ WebRenderCommandBuilder::GenerateFallbackData(
aStream.write((const char*)&count, sizeof(count));
for (auto& scaled : aScaledFonts) {
Maybe<wr::FontInstanceKey> key =
mManager->WrBridge()->GetFontKeyForScaledFont(
scaled, &aResources);
mManager->WrBridge()->GetFontKeyForScaledFont(scaled,
aResources);
if (key.isNothing()) {
validFonts = false;
break;
@@ -2600,7 +2600,7 @@ Maybe<wr::ImageMask> WebRenderCommandBuilder::BuildWrMaskImage(
for (auto& scaled : aScaledFonts) {
Maybe<wr::FontInstanceKey> key =
mManager->WrBridge()->GetFontKeyForScaledFont(scaled,
&aResources);
aResources);
if (key.isNothing()) {
validFonts = false;
break;