mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1076868 - Fix RemoveTextureFromCompositableAsync() call handling r=nical
This commit is contained in:
parent
0d9b8ad89a
commit
bda824b950
@ -607,7 +607,7 @@ ClientLayerManager::ForwardTransaction(bool aScheduleComposite)
|
||||
}
|
||||
|
||||
mForwarder->RemoveTexturesIfNecessary();
|
||||
mForwarder->SendPendingAsyncMessge();
|
||||
mForwarder->SendPendingAsyncMessges();
|
||||
mPhase = PHASE_NONE;
|
||||
|
||||
// this may result in Layers being deleted, which results in
|
||||
|
@ -171,6 +171,10 @@ CompositableClient::Destroy()
|
||||
if (!mCompositableChild) {
|
||||
return;
|
||||
}
|
||||
// Send pending AsyncMessages before deleting CompositableChild.
|
||||
// They might have dependency to the mCompositableChild.
|
||||
mForwarder->SendPendingAsyncMessges();
|
||||
// Delete CompositableChild.
|
||||
mCompositableChild->mCompositableClient = nullptr;
|
||||
PCompositableChild::Send__delete__(mCompositableChild);
|
||||
mCompositableChild = nullptr;
|
||||
|
@ -194,6 +194,8 @@ public:
|
||||
PTextureChild* aTexture,
|
||||
const FenceHandle& aFence) = 0;
|
||||
|
||||
virtual void SendPendingAsyncMessges() = 0;
|
||||
|
||||
void IdentifyTextureHost(const TextureFactoryIdentifier& aIdentifier);
|
||||
|
||||
virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE
|
||||
|
@ -555,7 +555,7 @@ ImageBridgeChild::EndTransaction()
|
||||
NS_RUNTIMEABORT("not reached");
|
||||
}
|
||||
}
|
||||
SendPendingAsyncMessge();
|
||||
SendPendingAsyncMessges();
|
||||
}
|
||||
|
||||
|
||||
@ -964,7 +964,7 @@ bool ImageBridgeChild::IsSameProcess() const
|
||||
return OtherProcess() == ipc::kInvalidProcessHandle;
|
||||
}
|
||||
|
||||
void ImageBridgeChild::SendPendingAsyncMessge()
|
||||
void ImageBridgeChild::SendPendingAsyncMessges()
|
||||
{
|
||||
if (!IsCreated() ||
|
||||
mTransactionsToRespond.empty()) {
|
||||
|
@ -310,7 +310,7 @@ public:
|
||||
|
||||
virtual bool IsSameProcess() const MOZ_OVERRIDE;
|
||||
|
||||
void SendPendingAsyncMessge();
|
||||
virtual void SendPendingAsyncMessges();
|
||||
|
||||
void MarkShutDown();
|
||||
protected:
|
||||
|
@ -858,6 +858,8 @@ LayerTransactionParent::DeallocPTextureParent(PTextureParent* actor)
|
||||
bool
|
||||
LayerTransactionParent::RecvChildAsyncMessages(const InfallibleTArray<AsyncChildMessageData>& aMessages)
|
||||
{
|
||||
AutoLayerTransactionParentAsyncMessageSender autoAsyncMessageSender(this);
|
||||
|
||||
for (AsyncChildMessageArray::index_type i = 0; i < aMessages.Length(); ++i) {
|
||||
const AsyncChildMessageData& message = aMessages[i];
|
||||
|
||||
@ -888,6 +890,30 @@ LayerTransactionParent::RecvChildAsyncMessages(const InfallibleTArray<AsyncChild
|
||||
TransactionCompleteted(op.transactionId());
|
||||
break;
|
||||
}
|
||||
case AsyncChildMessageData::TOpRemoveTextureAsync: {
|
||||
const OpRemoveTextureAsync& op = message.get_OpRemoveTextureAsync();
|
||||
CompositableHost* compositable = CompositableHost::FromIPDLActor(op.compositableParent());
|
||||
RefPtr<TextureHost> tex = TextureHost::AsTextureHost(op.textureParent());
|
||||
|
||||
MOZ_ASSERT(tex.get());
|
||||
compositable->RemoveTextureHost(tex);
|
||||
|
||||
// send FenceHandle if present via ImageBridge.
|
||||
ImageBridgeParent::SendFenceHandleToTrackerIfPresent(
|
||||
GetChildProcessId(),
|
||||
op.holderId(),
|
||||
op.transactionId(),
|
||||
op.textureParent(),
|
||||
compositable);
|
||||
|
||||
// Send message back via PImageBridge.
|
||||
ImageBridgeParent::ReplyRemoveTexture(
|
||||
GetChildProcessId(),
|
||||
OpReplyRemoveTexture(true, // isMain
|
||||
op.holderId(),
|
||||
op.transactionId()));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
NS_ERROR("unknown AsyncChildMessageData type");
|
||||
return false;
|
||||
|
@ -492,6 +492,7 @@ union AsyncParentMessageData {
|
||||
union AsyncChildMessageData {
|
||||
OpDeliverFenceFromChild;
|
||||
OpReplyDeliverFence;
|
||||
OpRemoveTextureAsync;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
@ -135,6 +135,8 @@ public:
|
||||
}
|
||||
bool Finished() const { return !mOpen && Empty(); }
|
||||
|
||||
bool Opened() const { return mOpen; }
|
||||
|
||||
EditVector mCset;
|
||||
EditVector mPaints;
|
||||
ShadowableLayerSet mMutants;
|
||||
@ -472,11 +474,19 @@ ShadowLayerForwarder::RemoveTextureFromCompositableAsync(AsyncTransactionTracker
|
||||
CompositableClient* aCompositable,
|
||||
TextureClient* aTexture)
|
||||
{
|
||||
mTxn->AddEdit(OpRemoveTextureAsync(CompositableClient::GetTrackersHolderId(aCompositable->GetIPDLActor()),
|
||||
aAsyncTransactionTracker->GetId(),
|
||||
nullptr, aCompositable->GetIPDLActor(),
|
||||
nullptr, aTexture->GetIPDLActor()));
|
||||
// Hold AsyncTransactionTracker until receving reply
|
||||
if (mTxn->Opened()) {
|
||||
mTxn->AddEdit(OpRemoveTextureAsync(CompositableClient::GetTrackersHolderId(aCompositable->GetIPDLActor()),
|
||||
aAsyncTransactionTracker->GetId(),
|
||||
nullptr, aCompositable->GetIPDLActor(),
|
||||
nullptr, aTexture->GetIPDLActor()));
|
||||
} else {
|
||||
// If the function is called outside of transaction,
|
||||
// OpRemoveTextureAsync message is stored as pending message.
|
||||
mPendingAsyncMessages.push_back(OpRemoveTextureAsync(CompositableClient::GetTrackersHolderId(aCompositable->GetIPDLActor()),
|
||||
aAsyncTransactionTracker->GetId(),
|
||||
nullptr, aCompositable->GetIPDLActor(),
|
||||
nullptr, aTexture->GetIPDLActor()));
|
||||
}
|
||||
CompositableClient::HoldUntilComplete(aCompositable->GetIPDLActor(),
|
||||
aAsyncTransactionTracker);
|
||||
}
|
||||
@ -821,7 +831,7 @@ void ShadowLayerForwarder::StopReceiveAsyncParentMessge()
|
||||
!mShadowManager->IPCOpen()) {
|
||||
return;
|
||||
}
|
||||
SendPendingAsyncMessge();
|
||||
SendPendingAsyncMessges();
|
||||
mShadowManager->SetForwarder(nullptr);
|
||||
}
|
||||
|
||||
@ -831,7 +841,7 @@ void ShadowLayerForwarder::ClearCachedResources()
|
||||
!mShadowManager->IPCOpen()) {
|
||||
return;
|
||||
}
|
||||
SendPendingAsyncMessge();
|
||||
SendPendingAsyncMessges();
|
||||
mShadowManager->SendClearCachedResources();
|
||||
}
|
||||
|
||||
@ -844,20 +854,31 @@ void ShadowLayerForwarder::Composite()
|
||||
mShadowManager->SendForceComposite();
|
||||
}
|
||||
|
||||
void ShadowLayerForwarder::SendPendingAsyncMessge()
|
||||
void ShadowLayerForwarder::SendPendingAsyncMessges()
|
||||
{
|
||||
if (!HasShadowManager() ||
|
||||
!mShadowManager->IPCOpen() ||
|
||||
mTransactionsToRespond.empty()) {
|
||||
!mShadowManager->IPCOpen()) {
|
||||
mTransactionsToRespond.clear();
|
||||
mPendingAsyncMessages.clear();
|
||||
return;
|
||||
}
|
||||
// Send OpReplyDeliverFence messages
|
||||
|
||||
if (mTransactionsToRespond.empty() && mPendingAsyncMessages.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
InfallibleTArray<AsyncChildMessageData> replies;
|
||||
replies.SetCapacity(mTransactionsToRespond.size());
|
||||
// Prepare OpReplyDeliverFence messages.
|
||||
for (size_t i = 0; i < mTransactionsToRespond.size(); i++) {
|
||||
replies.AppendElement(OpReplyDeliverFence(mTransactionsToRespond[i]));
|
||||
}
|
||||
mTransactionsToRespond.clear();
|
||||
// Prepare pending messages.
|
||||
for (size_t i = 0; i < mPendingAsyncMessages.size(); i++) {
|
||||
replies.AppendElement(mPendingAsyncMessages[i]);
|
||||
}
|
||||
mPendingAsyncMessages.clear();
|
||||
mShadowManager->SendChildAsyncMessages(replies);
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ public:
|
||||
|
||||
void Composite();
|
||||
|
||||
void SendPendingAsyncMessge();
|
||||
virtual void SendPendingAsyncMessges();
|
||||
|
||||
/**
|
||||
* True if this is forwarding to a LayerManagerComposite.
|
||||
@ -403,6 +403,7 @@ protected:
|
||||
private:
|
||||
|
||||
Transaction* mTxn;
|
||||
std::vector<AsyncChildMessageData> mPendingAsyncMessages;
|
||||
DiagnosticTypes mDiagnosticTypes;
|
||||
bool mIsFirstPaint;
|
||||
bool mWindowOverlayChanged;
|
||||
|
Loading…
Reference in New Issue
Block a user