Backout Bug 1221056 - make the destroy messages for PTexture and PCompositable part of the current transaction when applicable. r=sotaro

For breaking Firefox OS boot startup (see bug 1237197)
This commit is contained in:
Johan Lorenzo 2016-01-06 14:59:35 +01:00
parent d2a275509a
commit 67aa22b878
25 changed files with 85 additions and 270 deletions

View File

@ -7,7 +7,6 @@
#define MOZILLA_LAYERS_IPDLACTOR_H
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/layers/CompositableForwarder.h"
#include "mozilla/unused.h"
namespace mozilla {
@ -49,15 +48,13 @@ public:
///
/// This will asynchronously send a Destroy message to the parent actor, whom
/// will send the delete message.
void Destroy(CompositableForwarder* aFwd = nullptr)
void Destroy()
{
MOZ_ASSERT(!mDestroyed);
if (!mDestroyed) {
mDestroyed = true;
DestroyManagees();
if (!aFwd || !aFwd->DestroyInTransaction(this, false)) {
this->SendDestroy();
}
this->SendDestroy();
}
}
@ -66,27 +63,18 @@ public:
/// This will block until the Parent actor has handled the Destroy message,
/// and then start the asynchronous handshake (and destruction will already
/// be done on the parent side, when the async part happens).
void DestroySynchronously(CompositableForwarder* aFwd = nullptr)
void DestroySynchronously()
{
MOZ_PERFORMANCE_WARNING("gfx", "IPDL actor requires synchronous deallocation");
MOZ_ASSERT(!mDestroyed);
if (!mDestroyed) {
DestroyManagees();
mDestroyed = true;
if (!aFwd || !aFwd->DestroyInTransaction(this, true)) {
this->SendDestroySync();
this->SendDestroy();
}
this->SendDestroySync();
this->SendDestroy();
}
}
/// If the transaction that was supposed to destroy the texture fails for
/// whatever reason, fallback to destroying the actor synchronously.
static bool DestroyFallback(Protocol* aActor)
{
return aActor->SendDestroySync();
}
/// Override this if the protocol manages other protocols, and destroy the
/// managees from there
virtual void DestroyManagees() {}

View File

@ -644,6 +644,8 @@ ClientLayerManager::ForwardTransaction(bool aScheduleComposite)
mTransactionIdAllocator->RevokeTransactionId(mLatestTransactionId);
}
mForwarder->RemoveTexturesIfNecessary();
mForwarder->RemoveCompositablesIfNecessary();
mForwarder->SendPendingAsyncMessges();
mPhase = PHASE_NONE;

View File

@ -412,6 +412,7 @@ ClientTiledPaintedLayer::RenderLayer()
IntSize layerSize = mVisibleRegion.ToUnknownRegion().GetBounds().Size();
if (mContentClient && !mContentClient->SupportsLayerSize(layerSize, ClientManager())) {
ClientManager()->AsShadowForwarder()->HoldUntilTransaction(mContentClient);
mContentClient = nullptr;
mValidRegion.SetEmpty();
}

View File

@ -180,18 +180,13 @@ CompositableClient::Destroy()
if (!IsConnected()) {
return;
}
mCompositableChild->mCompositableClient = nullptr;
mCompositableChild->Destroy(mForwarder);
mCompositableChild = nullptr;
// Send pending AsyncMessages before deleting CompositableChild.
// They might have dependency to the mCompositableChild.
mForwarder->SendPendingAsyncMessges();
}
bool
CompositableClient::DestroyFallback(PCompositableChild* aActor)
{
return aActor->SendDestroySync();
// Destroy CompositableChild.
mCompositableChild->mCompositableClient = nullptr;
mCompositableChild->Destroy();
mCompositableChild = nullptr;
}
uint64_t

View File

@ -155,8 +155,6 @@ public:
void Destroy();
static bool DestroyFallback(PCompositableChild* aActor);
bool IsConnected() const;
PCompositableChild* GetIPDLActor() const;

View File

@ -300,13 +300,13 @@ DeallocateTextureClient(TextureDeallocParams params)
if (params.syncDeallocation) {
MOZ_PERFORMANCE_WARNING("gfx",
"TextureClient/Host pair requires synchronous deallocation");
actor->DestroySynchronously(actor->GetForwarder());
actor->DestroySynchronously();
DestroyTextureData(params.data, params.allocator, params.clientDeallocation,
actor->mMainThreadOnly);
} else {
actor->mTextureData = params.data;
actor->mOwnsTextureData = params.clientDeallocation;
actor->Destroy(actor->GetForwarder());
actor->Destroy();
// DestroyTextureData will be called by TextureChild::ActorDestroy
}
}
@ -346,14 +346,6 @@ void TextureClient::Destroy(bool aForceSync)
}
}
bool
TextureClient::DestroyFallback(PTextureChild* aActor)
{
// should not end up here so crash debug builds.
MOZ_ASSERT(false);
return aActor->SendDestroySync();
}
bool
TextureClient::Lock(OpenMode aMode)
{

View File

@ -415,8 +415,6 @@ public:
*/
static PTextureChild* CreateIPDLActor();
static bool DestroyIPDLActor(PTextureChild* actor);
// call this if the transaction that was supposed to destroy the actor failed.
static bool DestroyFallback(PTextureChild* actor);
/**
* Get the TextureClient corresponding to the actor passed in parameter.

View File

@ -227,12 +227,6 @@ CompositableHost::DumpTextureHost(std::stringstream& aStream, TextureHost* aText
aStream << gfxUtils::GetAsDataURI(dSurf).get();
}
void
CompositableHost::ReceivedDestroy(PCompositableParent* aActor)
{
static_cast<CompositableParent*>(aActor)->RecvDestroy();
}
namespace CompositableMap {
typedef std::map<uint64_t, PCompositableParent*> CompositableMap_t;

View File

@ -176,9 +176,6 @@ public:
}
bool IsAttached() { return mAttached; }
static void
ReceivedDestroy(PCompositableParent* aActor);
virtual void Dump(std::stringstream& aStream,
const char* aPrefix="",
bool aDumpHtml=false) { }

View File

@ -835,12 +835,6 @@ TextureParent::Destroy()
mTextureHost = nullptr;
}
void
TextureHost::ReceivedDestroy(PTextureParent* aActor)
{
static_cast<TextureParent*>(aActor)->RecvDestroy();
}
bool
TextureParent::RecvRecycleTexture(const TextureFlags& aTextureFlags)
{

View File

@ -463,8 +463,6 @@ public:
*/
static bool SendDeleteIPDLActor(PTextureParent* actor);
static void ReceivedDestroy(PTextureParent* actor);
/**
* Get the TextureHost corresponding to the actor passed in parameter.
*/

View File

@ -84,9 +84,6 @@ public:
const gfx::IntRect& aPictureRect) = 0;
#endif
virtual bool DestroyInTransaction(PTextureChild* aTexture, bool synchronously) = 0;
virtual bool DestroyInTransaction(PCompositableChild* aCompositable, bool synchronously) = 0;
/**
* Tell the CompositableHost on the compositor side to remove the texture
* from the CompositableHost.
@ -111,6 +108,40 @@ public:
CompositableClient* aCompositable,
TextureClient* aTexture) {}
/**
* Holds a reference to a TextureClient until after the next
* compositor transaction, and then drops it.
*/
virtual void HoldUntilTransaction(TextureClient* aClient)
{
if (aClient) {
mTexturesToRemove.AppendElement(aClient);
}
}
/**
* Forcibly remove texture data from TextureClient
* This function needs to be called after a tansaction with Compositor.
*/
virtual void RemoveTexturesIfNecessary()
{
mTexturesToRemove.Clear();
}
/**
* The same as above, but for CompositableClients.
*/
void HoldUntilTransaction(CompositableClient* aClient)
{
if (aClient) {
mCompositableClientsToRemove.AppendElement(aClient);
}
}
void RemoveCompositablesIfNecessary()
{
mCompositableClientsToRemove.Clear();
}
struct TimedTextureClient {
TimedTextureClient()
: mTextureClient(nullptr), mFrameID(0), mProducerID(0) {}

View File

@ -232,34 +232,9 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
return true;
}
void
CompositableParentManager::DestroyActor(const OpDestroy& aOp)
{
switch (aOp.type()) {
case OpDestroy::TPTextureParent: {
auto actor = aOp.get_PTextureParent();
TextureHost::ReceivedDestroy(actor);
break;
}
case OpDestroy::TPCompositableParent: {
auto actor = aOp.get_PCompositableParent();
CompositableHost::ReceivedDestroy(actor);
break;
}
default: {
MOZ_ASSERT(false, "unsupported type");
}
}
}
void
CompositableParentManager::SendPendingAsyncMessages()
{
for (auto& actor : mDestroyedTextures) {
TextureHost::SendDeleteIPDLActor(actor);
}
mDestroyedTextures.clear();
if (mPendingAsyncMessage.empty()) {
return;
}

View File

@ -46,8 +46,6 @@ protected:
*/
bool ReceiveCompositableUpdate(const CompositableOperation& aEdit,
EditReplyVector& replyv);
void DestroyActor(const OpDestroy& aOp);
bool IsOnCompositorSide() const override { return true; }
/**
@ -59,7 +57,6 @@ protected:
virtual void ReplyRemoveTexture(const OpReplyRemoveTexture& aReply) {}
std::vector<AsyncParentMessageData> mPendingAsyncMessage;
std::vector<PTextureParent*> mDestroyedTextures;
};
} // namespace layers

View File

@ -56,7 +56,6 @@ using namespace mozilla::gfx;
using namespace mozilla::media;
typedef std::vector<CompositableOperation> OpVector;
typedef nsTArray<OpDestroy> OpDestroyVector;
struct CompositableTransaction
{
@ -82,11 +81,10 @@ struct CompositableTransaction
mFinished = true;
mSwapRequired = false;
mOperations.clear();
mDestroyedActors.Clear();
}
bool IsEmpty() const
{
return mOperations.empty() && mDestroyedActors.IsEmpty();
return mOperations.empty();
}
void AddNoSwapEdit(const CompositableOperation& op)
{
@ -96,35 +94,10 @@ struct CompositableTransaction
void AddEdit(const CompositableOperation& op)
{
AddNoSwapEdit(op);
MarkSyncTransaction();
}
void MarkSyncTransaction()
{
mSwapRequired = true;
}
void FallbackDestroyActors()
{
for (auto& actor : mDestroyedActors) {
switch (actor.type()) {
case OpDestroy::TPTextureChild: {
DebugOnly<bool> ok = TextureClient::DestroyFallback(actor.get_PTextureChild());
MOZ_ASSERT(ok);
break;
}
case OpDestroy::TPCompositableChild: {
DebugOnly<bool> ok = CompositableClient::DestroyFallback(actor.get_PCompositableChild());
MOZ_ASSERT(ok);
break;
}
default: MOZ_CRASH();
}
}
mDestroyedActors.Clear();
}
OpVector mOperations;
OpDestroyVector mDestroyedActors;
bool mSwapRequired;
bool mFinished;
};
@ -205,12 +178,6 @@ void ReleaseImageBridgeParentSingleton() {
sImageBridgeParentSingleton = nullptr;
}
void
ImageBridgeChild::FallbackDestroyActors() {
if (mTxn && !mTxn->mDestroyedActors.IsEmpty()) {
mTxn->FallbackDestroyActors();
}
}
// dispatched function
static void ImageBridgeShutdownStep1(ReentrantMonitor *aBarrier, bool *aDone)
@ -237,8 +204,6 @@ static void ImageBridgeShutdownStep1(ReentrantMonitor *aBarrier, bool *aDone)
client->Destroy();
}
}
sImageBridgeChildSingleton->FallbackDestroyActors();
sImageBridgeChildSingleton->SendWillStop();
sImageBridgeChildSingleton->MarkShutDown();
// From now on, no message can be sent through the image bridge from the
@ -642,6 +607,20 @@ ImageBridgeChild::BeginTransaction()
mTxn->Begin();
}
class MOZ_STACK_CLASS AutoRemoveTexturesFromImageBridge
{
public:
explicit AutoRemoveTexturesFromImageBridge(ImageBridgeChild* aImageBridge)
: mImageBridge(aImageBridge) {}
~AutoRemoveTexturesFromImageBridge()
{
mImageBridge->RemoveTexturesIfNecessary();
}
private:
ImageBridgeChild* mImageBridge;
};
void
ImageBridgeChild::EndTransaction()
{
@ -649,6 +628,7 @@ ImageBridgeChild::EndTransaction()
MOZ_ASSERT(!mTxn->Finished(), "forgot BeginTransaction?");
AutoEndTransaction _(mTxn);
AutoRemoveTexturesFromImageBridge autoRemoveTextures(this);
if (mTxn->IsEmpty()) {
return;
@ -667,17 +647,15 @@ ImageBridgeChild::EndTransaction()
AutoInfallibleTArray<EditReply, 10> replies;
if (mTxn->mSwapRequired) {
if (!SendUpdate(cset, mTxn->mDestroyedActors, &replies)) {
if (!SendUpdate(cset, &replies)) {
NS_WARNING("could not send async texture transaction");
mTxn->FallbackDestroyActors();
return;
}
} else {
// If we don't require a swap we can call SendUpdateNoSwap which
// assumes that aReplies is empty (DEBUG assertion)
if (!SendUpdateNoSwap(cset, mTxn->mDestroyedActors)) {
if (!SendUpdateNoSwap(cset)) {
NS_WARNING("could not send async texture transaction (no swap)");
mTxn->FallbackDestroyActors();
return;
}
}
@ -1118,35 +1096,6 @@ ImageBridgeChild::CreateTexture(const SurfaceDescriptor& aSharedData,
return SendPTextureConstructor(aSharedData, aLayersBackend, aFlags);
}
static bool
IBCAddOpDestroy(CompositableTransaction* aTxn, const OpDestroy& op, bool synchronously)
{
if (aTxn->Finished()) {
return false;
}
aTxn->mDestroyedActors.AppendElement(op);
if (synchronously) {
aTxn->MarkSyncTransaction();
}
return true;
}
bool
ImageBridgeChild::DestroyInTransaction(PTextureChild* aTexture, bool synchronously)
{
return IBCAddOpDestroy(mTxn, OpDestroy(aTexture), synchronously);
}
bool
ImageBridgeChild::DestroyInTransaction(PCompositableChild* aCompositable, bool synchronously)
{
return IBCAddOpDestroy(mTxn, OpDestroy(aCompositable), synchronously);
}
void
ImageBridgeChild::RemoveTextureFromCompositable(CompositableClient* aCompositable,
TextureClient* aTexture)
@ -1165,6 +1114,8 @@ ImageBridgeChild::RemoveTextureFromCompositable(CompositableClient* aCompositabl
mTxn->AddNoSwapEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
nullptr, aTexture->GetIPDLActor()));
}
// Hold texture until transaction complete.
HoldUntilTransaction(aTexture);
}
void

View File

@ -262,9 +262,6 @@ public:
const nsIntRect& aPictureRect) override;
#endif
virtual bool DestroyInTransaction(PTextureChild* aTexture, bool synchronously) override;
virtual bool DestroyInTransaction(PCompositableChild* aCompositable, bool synchronously) override;
virtual void RemoveTextureFromCompositable(CompositableClient* aCompositable,
TextureClient* aTexture) override;
@ -321,8 +318,6 @@ public:
virtual void SendPendingAsyncMessges() override;
void MarkShutDown();
void FallbackDestroyActors();
protected:
ImageBridgeChild();
bool DispatchAllocShmemInternal(size_t aSize,

View File

@ -129,8 +129,7 @@ private:
};
bool
ImageBridgeParent::RecvUpdate(EditArray&& aEdits, OpDestroyArray&& aToDestroy,
EditReplyArray* aReply)
ImageBridgeParent::RecvUpdate(EditArray&& aEdits, EditReplyArray* aReply)
{
AutoImageBridgeParentAsyncMessageSender autoAsyncMessageSender(this);
@ -141,10 +140,6 @@ ImageBridgeParent::RecvUpdate(EditArray&& aEdits, OpDestroyArray&& aToDestroy,
}
}
for (const auto& op : aToDestroy) {
DestroyActor(op);
}
aReply->SetCapacity(replyv.size());
if (replyv.size() > 0) {
aReply->AppendElements(&replyv.front(), replyv.size());
@ -161,10 +156,10 @@ ImageBridgeParent::RecvUpdate(EditArray&& aEdits, OpDestroyArray&& aToDestroy,
}
bool
ImageBridgeParent::RecvUpdateNoSwap(EditArray&& aEdits, OpDestroyArray&& aToDestroy)
ImageBridgeParent::RecvUpdateNoSwap(EditArray&& aEdits)
{
InfallibleTArray<EditReply> noReplies;
bool success = RecvUpdate(Move(aEdits), Move(aToDestroy), &noReplies);
bool success = RecvUpdate(Move(aEdits), &noReplies);
MOZ_ASSERT(noReplies.Length() == 0, "RecvUpdateNoSwap requires a sync Update to carry Edits");
return success;
}

View File

@ -43,7 +43,6 @@ class ImageBridgeParent final : public PImageBridgeParent,
{
public:
typedef InfallibleTArray<CompositableOperation> EditArray;
typedef InfallibleTArray<OpDestroy> OpDestroyArray;
typedef InfallibleTArray<EditReply> EditReplyArray;
typedef InfallibleTArray<AsyncChildMessageData> AsyncChildMessageArray;
@ -68,9 +67,8 @@ public:
// PImageBridge
virtual bool RecvImageBridgeThreadId(const PlatformThreadId& aThreadId) override;
virtual bool RecvUpdate(EditArray&& aEdits, OpDestroyArray&& aToDestroy,
EditReplyArray* aReply) override;
virtual bool RecvUpdateNoSwap(EditArray&& aEdits, OpDestroyArray&& aToDestroy) override;
virtual bool RecvUpdate(EditArray&& aEdits, EditReplyArray* aReply) override;
virtual bool RecvUpdateNoSwap(EditArray&& aEdits) override;
virtual bool IsAsync() const override { return true; }

View File

@ -187,7 +187,6 @@ LayerTransactionParent::Destroy()
bool
LayerTransactionParent::RecvUpdateNoSwap(InfallibleTArray<Edit>&& cset,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aTransactionId,
const TargetConfig& targetConfig,
PluginsArray&& aPlugins,
@ -198,8 +197,7 @@ LayerTransactionParent::RecvUpdateNoSwap(InfallibleTArray<Edit>&& cset,
const mozilla::TimeStamp& aTransactionStart,
const int32_t& aPaintSyncId)
{
return RecvUpdate(Move(cset), Move(aToDestroy),
aTransactionId, targetConfig, Move(aPlugins), isFirstPaint,
return RecvUpdate(Move(cset), aTransactionId, targetConfig, Move(aPlugins), isFirstPaint,
scheduleComposite, paintSequenceNumber, isRepeatTransaction,
aTransactionStart, aPaintSyncId, nullptr);
}
@ -221,7 +219,6 @@ private:
bool
LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aTransactionId,
const TargetConfig& targetConfig,
PluginsArray&& aPlugins,
@ -244,10 +241,6 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
MOZ_LAYERS_LOG(("[ParentSide] received txn with %d edits", cset.Length()));
if (mDestroyed || !layer_manager() || layer_manager()->IsDestroyed()) {
for (const auto& op : aToDestroy) {
DestroyActor(op);
}
return true;
}
@ -600,10 +593,6 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
}
}
for (const auto& op : aToDestroy) {
DestroyActor(op);
}
mShadowLayersManager->ShadowLayersUpdated(this, aTransactionId, targetConfig,
aPlugins, isFirstPaint, scheduleComposite,
paintSequenceNumber, isRepeatTransaction,

View File

@ -40,7 +40,6 @@ class LayerTransactionParent final : public PLayerTransactionParent,
{
typedef mozilla::layout::RenderFrameParent RenderFrameParent;
typedef InfallibleTArray<Edit> EditArray;
typedef InfallibleTArray<OpDestroy> OpDestroyArray;
typedef InfallibleTArray<EditReply> EditReplyArray;
typedef InfallibleTArray<AsyncChildMessageData> AsyncChildMessageArray;
typedef InfallibleTArray<PluginWindowData> PluginsArray;
@ -94,7 +93,6 @@ protected:
virtual bool RecvShutdown() override;
virtual bool RecvUpdate(EditArray&& cset,
OpDestroyArray&& aToDestroy,
const uint64_t& aTransactionId,
const TargetConfig& targetConfig,
PluginsArray&& aPlugins,
@ -107,7 +105,6 @@ protected:
EditReplyArray* reply) override;
virtual bool RecvUpdateNoSwap(EditArray&& cset,
OpDestroyArray&& aToDestroy,
const uint64_t& aTransactionId,
const TargetConfig& targetConfig,
PluginsArray&& aPlugins,

View File

@ -471,12 +471,6 @@ union Edit {
CompositableOperation;
};
// Operations related to destroying resources, always handled after the other
// operations for safety.
union OpDestroy {
PTexture;
PCompositable;
};
// Replies to operations

View File

@ -42,10 +42,8 @@ child:
parent:
async ImageBridgeThreadId(PlatformThreadId aTreahdId);
sync Update(CompositableOperation[] ops, OpDestroy[] toDestroy)
returns (EditReply[] reply);
async UpdateNoSwap(CompositableOperation[] ops, OpDestroy[] toDestroy);
sync Update(CompositableOperation[] ops) returns (EditReply[] reply);
async UpdateNoSwap(CompositableOperation[] ops);
// First step of the destruction sequence. This puts ImageBridge
// in a state in which it can't send asynchronous messages

View File

@ -55,8 +55,7 @@ parent:
// The isFirstPaint flag can be used to indicate that this is the first update
// for a particular document.
sync Update(Edit[] cset, OpDestroy[] toDestroy,
uint64_t id, TargetConfig targetConfig,
sync Update(Edit[] cset, uint64_t id, TargetConfig targetConfig,
PluginWindowData[] plugins, bool isFirstPaint,
bool scheduleComposite, uint32_t paintSequenceNumber,
bool isRepeatTransaction, TimeStamp transactionStart,
@ -65,8 +64,7 @@ parent:
// We don't need to send a sync transaction if
// no transaction operate require a swap.
async UpdateNoSwap(Edit[] cset, OpDestroy[] toDestroy,
uint64_t id, TargetConfig targetConfig,
async UpdateNoSwap(Edit[] cset, uint64_t id, TargetConfig targetConfig,
PluginWindowData[] plugins, bool isFirstPaint,
bool scheduleComposite, uint32_t paintSequenceNumber,
bool isRepeatTransaction, TimeStamp transactionStart,

View File

@ -17,7 +17,6 @@
#include "gfxPlatform.h" // for gfxImageFormat, gfxPlatform
#include "gfxSharedImageSurface.h" // for gfxSharedImageSurface
#include "ipc/IPCMessageUtils.h" // for gfxContentType, null_t
#include "IPDLActor.h"
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/gfx/Point.h" // for IntSize
#include "mozilla/layers/CompositableClient.h" // for CompositableClient, etc
@ -49,7 +48,6 @@ class ClientTiledLayerBuffer;
typedef nsTArray<SurfaceDescriptor> BufferArray;
typedef std::vector<Edit> EditVector;
typedef std::set<ShadowableLayer*> ShadowableLayerSet;
typedef nsTArray<OpDestroy> OpDestroyVector;
class Transaction
{
@ -120,15 +118,13 @@ public:
mCset.clear();
mPaints.clear();
mMutants.clear();
mDestroyedActors.Clear();
mOpen = false;
mSwapRequired = false;
mRotationChanged = false;
}
bool Empty() const {
return mCset.empty() && mPaints.empty() && mMutants.empty()
&& mDestroyedActors.IsEmpty();
return mCset.empty() && mPaints.empty() && mMutants.empty();
}
bool RotationChanged() const {
return mRotationChanged;
@ -137,29 +133,8 @@ public:
bool Opened() const { return mOpen; }
void FallbackDestroyActors()
{
for (auto& actor : mDestroyedActors) {
switch (actor.type()) {
case OpDestroy::TPTextureChild: {
DebugOnly<bool> ok = TextureClient::DestroyFallback(actor.get_PTextureChild());
MOZ_ASSERT(ok);
break;
}
case OpDestroy::TPCompositableChild: {
DebugOnly<bool> ok = CompositableClient::DestroyFallback(actor.get_PCompositableChild());
MOZ_ASSERT(ok);
break;
}
default: MOZ_CRASH();
}
}
mDestroyedActors.Clear();
}
EditVector mCset;
EditVector mPaints;
OpDestroyVector mDestroyedActors;
ShadowableLayerSet mMutants;
gfx::IntRect mTargetBounds;
ScreenRotation mTargetRotation;
@ -200,9 +175,6 @@ ShadowLayerForwarder::ShadowLayerForwarder()
ShadowLayerForwarder::~ShadowLayerForwarder()
{
MOZ_ASSERT(mTxn->Finished(), "unfinished transaction?");
if (!mTxn->mDestroyedActors.IsEmpty()) {
mTxn->FallbackDestroyActors();
}
delete mTxn;
if (mShadowManager) {
mShadowManager->SetForwarder(nullptr);
@ -443,33 +415,6 @@ ShadowLayerForwarder::UseOverlaySource(CompositableClient* aCompositable,
}
#endif
static bool
AddOpDestroy(Transaction* aTxn, const OpDestroy& op, bool synchronously)
{
if (!aTxn->Opened()) {
return false;
}
aTxn->mDestroyedActors.AppendElement(op);
if (synchronously) {
aTxn->MarkSyncTransaction();
}
return true;
}
bool
ShadowLayerForwarder::DestroyInTransaction(PTextureChild* aTexture, bool synchronously)
{
return AddOpDestroy(mTxn, OpDestroy(aTexture), synchronously);
}
bool
ShadowLayerForwarder::DestroyInTransaction(PCompositableChild* aCompositable, bool synchronously)
{
return AddOpDestroy(mTxn, OpDestroy(aCompositable), synchronously);
}
void
ShadowLayerForwarder::RemoveTextureFromCompositable(CompositableClient* aCompositable,
TextureClient* aTexture)
@ -488,6 +433,8 @@ ShadowLayerForwarder::RemoveTextureFromCompositable(CompositableClient* aComposi
if (aTexture->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
mTxn->MarkSyncTransaction();
}
// Hold texture until transaction complete.
HoldUntilTransaction(aTexture);
}
void
@ -700,13 +647,11 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
RenderTraceScope rendertrace3("Forward Transaction", "000093");
if (!HasShadowManager() ||
!mShadowManager->IPCOpen() ||
!mShadowManager->SendUpdate(cset, mTxn->mDestroyedActors,
aId, targetConfig, mPluginWindowData,
!mShadowManager->SendUpdate(cset, aId, targetConfig, mPluginWindowData,
mIsFirstPaint, aScheduleComposite,
aPaintSequenceNumber, aIsRepeatTransaction,
aTransactionStart, mPaintSyncId, aReplies)) {
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
mTxn->FallbackDestroyActors();
return false;
}
} else {
@ -716,13 +661,11 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
RenderTraceScope rendertrace3("Forward NoSwap Transaction", "000093");
if (!HasShadowManager() ||
!mShadowManager->IPCOpen() ||
!mShadowManager->SendUpdateNoSwap(cset, mTxn->mDestroyedActors,
aId, targetConfig, mPluginWindowData,
!mShadowManager->SendUpdateNoSwap(cset, aId, targetConfig, mPluginWindowData,
mIsFirstPaint, aScheduleComposite,
aPaintSequenceNumber, aIsRepeatTransaction,
aTransactionStart, mPaintSyncId)) {
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
mTxn->FallbackDestroyActors();
return false;
}
}

View File

@ -214,9 +214,6 @@ public:
virtual void UseTiledLayerBuffer(CompositableClient* aCompositable,
const SurfaceDescriptorTiles& aTileLayerDescriptor) override;
virtual bool DestroyInTransaction(PTextureChild* aTexture, bool synchronously) override;
virtual bool DestroyInTransaction(PCompositableChild* aCompositable, bool synchronously) override;
virtual void RemoveTextureFromCompositable(CompositableClient* aCompositable,
TextureClient* aTexture) override;