зеркало из https://github.com/mozilla/gecko-dev.git
Bug 926745 - Don't call ForceRemove manually in compositable code. r=nical,sotaro
This commit is contained in:
Родитель
5c9776f6ef
Коммит
e87838a972
|
@ -53,7 +53,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
|
|||
{
|
||||
if (mBuffer &&
|
||||
(mBuffer->IsImmutable() || mBuffer->GetSize() != aSize)) {
|
||||
GetForwarder()->AddForceRemovingTexture(mBuffer);
|
||||
GetForwarder()->HoldUntilTransaction(mBuffer);
|
||||
mBuffer = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -388,7 +388,7 @@ ClientLayerManager::ForwardTransaction(bool aScheduleComposite)
|
|||
NS_WARNING("failed to forward Layers transaction");
|
||||
}
|
||||
|
||||
mForwarder->ForceRemoveTexturesIfNecessary();
|
||||
mForwarder->RemoveTexturesIfNecessary();
|
||||
mPhase = PHASE_NONE;
|
||||
|
||||
// this may result in Layers being deleted, which results in
|
||||
|
|
|
@ -103,7 +103,7 @@ void
|
|||
ImageClientSingle::FlushAllImages(bool aExceptFront)
|
||||
{
|
||||
if (!aExceptFront && mFrontBuffer) {
|
||||
GetForwarder()->AddForceRemovingTexture(mFrontBuffer);
|
||||
GetForwarder()->HoldUntilTransaction(mFrontBuffer);
|
||||
mFrontBuffer = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -112,11 +112,11 @@ void
|
|||
ImageClientBuffered::FlushAllImages(bool aExceptFront)
|
||||
{
|
||||
if (!aExceptFront && mFrontBuffer) {
|
||||
GetForwarder()->AddForceRemovingTexture(mFrontBuffer);
|
||||
GetForwarder()->HoldUntilTransaction(mFrontBuffer);
|
||||
mFrontBuffer = nullptr;
|
||||
}
|
||||
if (mBackBuffer) {
|
||||
GetForwarder()->AddForceRemovingTexture(mBackBuffer);
|
||||
GetForwarder()->HoldUntilTransaction(mBackBuffer);
|
||||
mBackBuffer = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -140,14 +140,9 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
|
|||
// fast path: no need to allocate and/or copy image data
|
||||
RefPtr<TextureClient> texture = image->AsSharedImage()->GetTextureClient();
|
||||
|
||||
if (texture->IsSharedWithCompositor()) {
|
||||
// XXX - temporary fix for bug 911941
|
||||
// This will be changed with bug 912907
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mFrontBuffer) {
|
||||
GetForwarder()->AddForceRemovingTexture(mFrontBuffer);
|
||||
GetForwarder()->HoldUntilTransaction(mFrontBuffer);
|
||||
}
|
||||
mFrontBuffer = texture;
|
||||
if (!AddTextureClient(texture)) {
|
||||
|
@ -164,7 +159,7 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
|
|||
}
|
||||
|
||||
if (mFrontBuffer && mFrontBuffer->IsImmutable()) {
|
||||
GetForwarder()->AddForceRemovingTexture(mFrontBuffer);
|
||||
GetForwarder()->HoldUntilTransaction(mFrontBuffer);
|
||||
mFrontBuffer = nullptr;
|
||||
}
|
||||
|
||||
|
@ -207,7 +202,7 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
|
|||
gfx::IntSize size = gfx::IntSize(image->GetSize().width, image->GetSize().height);
|
||||
|
||||
if (mFrontBuffer) {
|
||||
GetForwarder()->AddForceRemovingTexture(mFrontBuffer);
|
||||
GetForwarder()->HoldUntilTransaction(mFrontBuffer);
|
||||
mFrontBuffer = nullptr;
|
||||
}
|
||||
|
||||
|
@ -228,7 +223,7 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
|
|||
|
||||
if (mFrontBuffer &&
|
||||
(mFrontBuffer->IsImmutable() || mFrontBuffer->GetSize() != size)) {
|
||||
GetForwarder()->AddForceRemovingTexture(mFrontBuffer);
|
||||
GetForwarder()->HoldUntilTransaction(mFrontBuffer);
|
||||
mFrontBuffer = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -161,8 +161,11 @@ TextureClient::DestroyIPDLActor(PTextureChild* actor)
|
|||
bool
|
||||
TextureClient::InitIPDLActor(CompositableForwarder* aForwarder)
|
||||
{
|
||||
MOZ_ASSERT(!mActor);
|
||||
MOZ_ASSERT(aForwarder);
|
||||
if (mActor && mActor->GetForwarder() == aForwarder) {
|
||||
return true;
|
||||
}
|
||||
MOZ_ASSERT(!mActor, "Cannot use a texture on several IPC channels.");
|
||||
|
||||
SurfaceDescriptor desc;
|
||||
if (!ToSurfaceDescriptor(desc)) {
|
||||
|
|
|
@ -162,13 +162,13 @@ public:
|
|||
virtual void RemoveTexture(TextureClient* aTexture) = 0;
|
||||
|
||||
/**
|
||||
* Forcibly remove texture data from TextureClient
|
||||
* after a tansaction with Compositor.
|
||||
* Holds a reference to a TextureClient until after the next
|
||||
* compositor transaction, and then drops it.
|
||||
*/
|
||||
virtual void AddForceRemovingTexture(TextureClient* aClient)
|
||||
virtual void HoldUntilTransaction(TextureClient* aClient)
|
||||
{
|
||||
if (aClient) {
|
||||
mForceRemovingTextures.AppendElement(aClient);
|
||||
mTexturesToRemove.AppendElement(aClient);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,12 +176,9 @@ public:
|
|||
* Forcibly remove texture data from TextureClient
|
||||
* This function needs to be called after a tansaction with Compositor.
|
||||
*/
|
||||
virtual void ForceRemoveTexturesIfNecessary()
|
||||
virtual void RemoveTexturesIfNecessary()
|
||||
{
|
||||
for (uint32_t i = 0; i < mForceRemovingTextures.Length(); i++) {
|
||||
mForceRemovingTextures[i]->ForceRemove();
|
||||
}
|
||||
mForceRemovingTextures.Clear();
|
||||
mTexturesToRemove.Clear();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -244,7 +241,7 @@ public:
|
|||
protected:
|
||||
TextureFactoryIdentifier mTextureFactoryIdentifier;
|
||||
bool mMultiProcess;
|
||||
nsTArray<RefPtr<TextureClient> > mForceRemovingTextures;
|
||||
nsTArray<RefPtr<TextureClient> > mTexturesToRemove;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -453,15 +453,15 @@ ImageBridgeChild::BeginTransaction()
|
|||
mTxn->Begin();
|
||||
}
|
||||
|
||||
class MOZ_STACK_CLASS AutoForceRemoveTextures
|
||||
class MOZ_STACK_CLASS AutoRemoveTextures
|
||||
{
|
||||
public:
|
||||
AutoForceRemoveTextures(ImageBridgeChild* aImageBridge)
|
||||
AutoRemoveTextures(ImageBridgeChild* aImageBridge)
|
||||
: mImageBridge(aImageBridge) {}
|
||||
|
||||
~AutoForceRemoveTextures()
|
||||
~AutoRemoveTextures()
|
||||
{
|
||||
mImageBridge->ForceRemoveTexturesIfNecessary();
|
||||
mImageBridge->RemoveTexturesIfNecessary();
|
||||
}
|
||||
private:
|
||||
ImageBridgeChild* mImageBridge;
|
||||
|
@ -473,7 +473,7 @@ ImageBridgeChild::EndTransaction()
|
|||
MOZ_ASSERT(!mTxn->Finished(), "forgot BeginTransaction?");
|
||||
|
||||
AutoEndTransaction _(mTxn);
|
||||
AutoForceRemoveTextures autoForceRemoveTextures(this);
|
||||
AutoRemoveTextures autoRemoveTextures(this);
|
||||
|
||||
if (mTxn->IsEmpty()) {
|
||||
return;
|
||||
|
|
Загрузка…
Ссылка в новой задаче