Bug 1748788 - Send parent commands with ClearCachedResources r=gfx-reviewers,nical

RecvClearCachedResources() does not handle parent commands. They are handled by a different transaction. It caused the problem. To avoid the problem, modifying RecvClearCachedResources() as to handle parent commands.

Differential Revision: https://phabricator.services.mozilla.com/D139568
This commit is contained in:
sotaro 2022-02-25 15:43:19 +00:00
Родитель 5f1b917e52
Коммит 4388cf2116
4 изменённых файлов: 15 добавлений и 8 удалений

Просмотреть файл

@ -68,7 +68,7 @@ parent:
async ParentCommands(WebRenderParentCommand[] commands);
sync GetSnapshot(PTexture texture) returns (bool aNeedsYFlip);
async SetLayersObserverEpoch(LayersObserverEpoch childEpoch);
async ClearCachedResources();
async ClearCachedResources(WebRenderParentCommand[] commands);
async SetDefaultClearColor(uint32_t aColor);
// Invalidate rendered frame
async InvalidateRenderedFrame();

Просмотреть файл

@ -508,10 +508,6 @@ mozilla::ipc::IPCResult WebRenderBridgeChild::RecvWrReleasedImages(
void WebRenderBridgeChild::BeginClearCachedResources() {
mSentDisplayList = false;
mIsInClearCachedResources = true;
// Clear display list and animtaions at parent side before clearing cached
// resources on client side. It prevents to clear resources before clearing
// display list at parent side.
SendClearCachedResources();
}
void WebRenderBridgeChild::EndClearCachedResources() {
@ -519,7 +515,9 @@ void WebRenderBridgeChild::EndClearCachedResources() {
mIsInClearCachedResources = false;
return;
}
ProcessWebRenderParentCommands();
SendClearCachedResources(mParentCommands);
mParentCommands.Clear();
mIsInClearCachedResources = false;
}

Просмотреть файл

@ -1883,7 +1883,8 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvSetLayersObserverEpoch(
return IPC_OK();
}
mozilla::ipc::IPCResult WebRenderBridgeParent::RecvClearCachedResources() {
mozilla::ipc::IPCResult WebRenderBridgeParent::RecvClearCachedResources(
nsTArray<WebRenderParentCommand>&& aCommands) {
if (mDestroyed) {
return IPC_OK();
}
@ -1896,6 +1897,9 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvClearCachedResources() {
// Clear resources
wr::TransactionBuilder txn(mApi);
txn.SetLowPriority(true);
bool success = ProcessWebRenderParentCommands(aCommands, txn);
txn.ClearDisplayList(GetNextWrEpoch(), mPipelineId);
txn.Notify(
wr::Checkpoint::SceneBuilt,
@ -1908,6 +1912,10 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvClearCachedResources() {
ClearAnimationResources();
if (!success) {
return IPC_FAIL(this, "Invalid parent command found");
}
return IPC_OK();
}

Просмотреть файл

@ -140,7 +140,8 @@ class WebRenderBridgeParent final : public PWebRenderBridgeParent,
mozilla::ipc::IPCResult RecvSetLayersObserverEpoch(
const LayersObserverEpoch& aChildEpoch) override;
mozilla::ipc::IPCResult RecvClearCachedResources() override;
mozilla::ipc::IPCResult RecvClearCachedResources(
nsTArray<WebRenderParentCommand>&& aCommands) override;
mozilla::ipc::IPCResult RecvInvalidateRenderedFrame() override;
mozilla::ipc::IPCResult RecvScheduleComposite(
const wr::RenderReasons& aReasons) override;