Bug 1459714 - Make WebRenderBridgeParent::ProcessWebRenderParentCommands callers provide the transaction. r?sotaro
MozReview-Commit-ID: FIrA11wgjLI
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -613,19 +613,20 @@ WebRenderBridgeParent::RecvSetDisplayLis
// This ensures that destroy operations are always processed. It is not safe
// to early-return from RecvDPEnd without doing so.
AutoWebRenderBridgeParentAsyncMessageSender autoAsyncMessageSender(this, &aToDestroy);
wr::Epoch wrEpoch = GetNextWrEpoch();
mAsyncImageManager->SetCompositionTime(TimeStamp::Now());
- ProcessWebRenderParentCommands(aCommands);
+ wr::TransactionBuilder txn;
+ ProcessWebRenderParentCommands(aCommands, txn);
+ mApi->SendTransaction(txn);
- wr::TransactionBuilder txn;
if (!UpdateResources(aResourceUpdates, aSmallShmems, aLargeShmems, txn)) {
return IPC_FAIL(this, "Failed to deserialize resource updates");
}
mReceivedDisplayList = true;
// aScrollData is moved into this function but that is not reflected by the
// function signature due to the way the IPDL generator works. We remove the
@@ -703,17 +704,19 @@ WebRenderBridgeParent::RecvEmptyTransact
UpdateFwdTransactionId(aFwdTransactionId);
// This ensures that destroy operations are always processed. It is not safe
// to early-return without doing so.
AutoWebRenderBridgeParentAsyncMessageSender autoAsyncMessageSender(this, &aToDestroy);
if (!aCommands.IsEmpty()) {
mAsyncImageManager->SetCompositionTime(TimeStamp::Now());
- ProcessWebRenderParentCommands(aCommands);
+ wr::TransactionBuilder txn;
+ ProcessWebRenderParentCommands(aCommands, txn);
+ mApi->SendTransaction(txn);
ScheduleGenerateFrame();
}
UpdateAPZFocusState(aFocusTarget);
if (!aCommands.IsEmpty()) {
wr::TransactionBuilder txn;
wr::Epoch wrEpoch = GetNextWrEpoch();
@@ -746,37 +749,39 @@ WebRenderBridgeParent::RecvSetFocusTarge
}
mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvParentCommands(nsTArray<WebRenderParentCommand>&& aCommands)
{
if (mDestroyed) {
return IPC_OK();
}
- ProcessWebRenderParentCommands(aCommands);
+ wr::TransactionBuilder txn;
+ ProcessWebRenderParentCommands(aCommands, txn);
+ mApi->SendTransaction(txn);
return IPC_OK();
}
void
-WebRenderBridgeParent::ProcessWebRenderParentCommands(const InfallibleTArray<WebRenderParentCommand>& aCommands)
+WebRenderBridgeParent::ProcessWebRenderParentCommands(const InfallibleTArray<WebRenderParentCommand>& aCommands,
+ wr::TransactionBuilder& aTxn)
{
- wr::TransactionBuilder txn;
for (InfallibleTArray<WebRenderParentCommand>::index_type i = 0; i < aCommands.Length(); ++i) {
const WebRenderParentCommand& cmd = aCommands[i];
switch (cmd.type()) {
case WebRenderParentCommand::TOpAddPipelineIdForCompositable: {
const OpAddPipelineIdForCompositable& op = cmd.get_OpAddPipelineIdForCompositable();
AddPipelineIdForCompositable(op.pipelineId(),
op.handle(),
op.isAsync());
break;
}
case WebRenderParentCommand::TOpRemovePipelineIdForCompositable: {
const OpRemovePipelineIdForCompositable& op = cmd.get_OpRemovePipelineIdForCompositable();
- RemovePipelineIdForCompositable(op.pipelineId(), txn);
+ RemovePipelineIdForCompositable(op.pipelineId(), aTxn);
break;
}
case WebRenderParentCommand::TOpAddExternalImageIdForCompositable: {
const OpAddExternalImageIdForCompositable& op = cmd.get_OpAddExternalImageIdForCompositable();
AddExternalImageIdForCompositable(op.externalImageId(),
op.handle());
break;
}
@@ -820,17 +825,16 @@ WebRenderBridgeParent::ProcessWebRenderP
break;
}
default: {
// other commands are handle on the child
break;
}
}
}
- mApi->SendTransaction(txn);
}
mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvGetSnapshot(PTextureParent* aTexture)
{
if (mDestroyed) {
return IPC_OK();
}
--- a/gfx/layers/wr/WebRenderBridgeParent.h
+++ b/gfx/layers/wr/WebRenderBridgeParent.h
@@ -205,17 +205,18 @@ private:
void RemovePipelineIdForCompositable(const wr::PipelineId& aPipelineId,
wr::TransactionBuilder& aTxn);
void AddExternalImageIdForCompositable(const ExternalImageId& aImageId,
const CompositableHandle& aHandle);
void RemoveExternalImageId(const ExternalImageId& aImageId);
LayersId GetLayersId() const;
- void ProcessWebRenderParentCommands(const InfallibleTArray<WebRenderParentCommand>& aCommands);
+ void ProcessWebRenderParentCommands(const InfallibleTArray<WebRenderParentCommand>& aCommands,
+ wr::TransactionBuilder& aTxn);
void ClearResources();
uint64_t GetChildLayerObserverEpoch() const { return mChildLayerObserverEpoch; }
bool ShouldParentObserveEpoch();
mozilla::ipc::IPCResult HandleShutdown();
void AdvanceAnimations();
void SampleAnimations(nsTArray<wr::WrOpacityProperty>& aOpacityArray,