Backed out changeset 315c9f0af9bb (bug 902929)

This commit is contained in:
Wes Kocher 2013-08-20 20:50:20 -07:00
parent c69d8f108a
commit 2a9e21a70f
9 changed files with 16 additions and 56 deletions

View File

@ -366,11 +366,6 @@ MediaPluginReader::ImageBufferCallback::operator()(size_t aWidth, size_t aHeight
rgbImage = mozilla::layers::CreateSharedRGBImage(mImageContainer,
nsIntSize(aWidth, aHeight),
gfxASurface::ImageFormatRGB16_565);
if (!rgbImage) {
NS_WARNING("Could not create rgb image");
return nullptr;
}
mImage = rgbImage;
return rgbImage->AsSharedImage()->GetBuffer();
case MPAPI::YCbCr:

View File

@ -119,7 +119,7 @@ void
CanvasLayerComposite::CleanupResources()
{
if (mImageHost) {
mImageHost->Detach(this);
mImageHost->Detach();
}
mImageHost = nullptr;
}

View File

@ -28,7 +28,6 @@ CompositableHost::CompositableHost(const TextureInfo& aTextureInfo)
, mCompositor(nullptr)
, mLayer(nullptr)
, mAttached(false)
, mKeepAttached(false)
{
MOZ_COUNT_CTOR(CompositableHost);
}

View File

@ -210,39 +210,19 @@ public:
virtual TiledLayerComposer* AsTiledLayerComposer() { return nullptr; }
typedef uint32_t AttachFlags;
static const AttachFlags NO_FLAGS = 0;
static const AttachFlags ALLOW_REATTACH = 1;
static const AttachFlags KEEP_ATTACHED = 2;
virtual void Attach(Layer* aLayer,
Compositor* aCompositor,
AttachFlags aFlags = NO_FLAGS)
virtual void Attach(Layer* aLayer, Compositor* aCompositor)
{
MOZ_ASSERT(aCompositor, "Compositor is required");
NS_ASSERTION(aFlags & ALLOW_REATTACH || !mAttached,
"Re-attaching compositables must be explicitly authorised");
MOZ_ASSERT(!IsAttached());
SetCompositor(aCompositor);
SetLayer(aLayer);
mAttached = true;
mKeepAttached = aFlags & KEEP_ATTACHED;
}
// Detach this compositable host from its layer.
// If we are used for async video, then it is not safe to blindly detach since
// we might be re-attached to a different layer. aLayer is the layer which the
// caller expects us to be attached to, we will only detach if we are in fact
// attached to that layer. If we are part of a normal layer, then we will be
// detached in any case. if aLayer is null, then we will only detach if we are
// not async.
void Detach(Layer* aLayer = nullptr)
void Detach()
{
if (!mKeepAttached ||
aLayer == mLayer) {
SetLayer(nullptr);
SetCompositor(nullptr);
mAttached = false;
mKeepAttached = false;
}
SetLayer(nullptr);
SetCompositor(nullptr);
mAttached = false;
}
bool IsAttached() { return mAttached; }
@ -271,7 +251,6 @@ protected:
Layer* mLayer;
RefPtr<TextureHost> mFirstTexture;
bool mAttached;
bool mKeepAttached;
};
class CompositableParentManager;

View File

@ -169,7 +169,7 @@ void
ThebesLayerComposite::CleanupResources()
{
if (mBuffer) {
mBuffer->Detach(this);
mBuffer->Detach();
}
mBuffer = nullptr;
}

View File

@ -67,11 +67,9 @@ TiledLayerBufferComposite::ValidateTile(TiledTexture aTile,
}
void
TiledContentHost::Attach(Layer* aLayer,
Compositor* aCompositor,
AttachFlags aFlags /* = NO_FLAGS */)
TiledContentHost::Attach(Layer* aLayer, Compositor* aCompositor)
{
CompositableHost::Attach(aLayer, aCompositor, aFlags);
CompositableHost::Attach(aLayer, aCompositor);
static_cast<ThebesLayerComposite*>(aLayer)->EnsureTiled();
}

View File

@ -237,9 +237,7 @@ public:
mLowPrecisionVideoMemoryTiledBuffer.SetCompositor(aCompositor);
}
virtual void Attach(Layer* aLayer,
Compositor* aCompositor,
AttachFlags aFlags = NO_FLAGS) MOZ_OVERRIDE;
virtual void Attach(Layer* aLayer, Compositor* aCompositor) MOZ_OVERRIDE;
#ifdef MOZ_DUMP_PAINTING
virtual void Dump(FILE* aFile=nullptr,

View File

@ -405,7 +405,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
}
case Edit::TOpAttachCompositable: {
const OpAttachCompositable& op = edit.get_OpAttachCompositable();
Attach(cast(op.layerParent()), cast(op.compositableParent()), false);
Attach(cast(op.layerParent()), cast(op.compositableParent()));
cast(op.compositableParent())->SetCompositorID(
mLayerManager->GetCompositor()->GetCompositorID());
break;
@ -414,7 +414,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
const OpAttachAsyncCompositable& op = edit.get_OpAttachAsyncCompositable();
CompositableParent* compositableParent = CompositableMap::Get(op.containerID());
MOZ_ASSERT(compositableParent, "CompositableParent not found in the map");
Attach(cast(op.layerParent()), compositableParent, true);
Attach(cast(op.layerParent()), compositableParent);
compositableParent->SetCompositorID(mLayerManager->GetCompositor()->GetCompositorID());
break;
}
@ -501,9 +501,7 @@ LayerTransactionParent::RecvGetTransform(PLayerParent* aParent,
}
void
LayerTransactionParent::Attach(ShadowLayerParent* aLayerParent,
CompositableParent* aCompositable,
bool aIsAsyncVideo)
LayerTransactionParent::Attach(ShadowLayerParent* aLayerParent, CompositableParent* aCompositable)
{
LayerComposite* layer = aLayerParent->AsLayer()->AsLayerComposite();
MOZ_ASSERT(layer);
@ -514,12 +512,7 @@ LayerTransactionParent::Attach(ShadowLayerParent* aLayerParent,
CompositableHost* compositable = aCompositable->GetCompositableHost();
MOZ_ASSERT(compositable);
layer->SetCompositableHost(compositable);
compositable->Attach(aLayerParent->AsLayer(),
compositor,
aIsAsyncVideo
? CompositableHost::ALLOW_REATTACH
| CompositableHost::KEEP_ATTACHED
: CompositableHost::NO_FLAGS);
compositable->Attach(aLayerParent->AsLayer(), compositor);
}
bool

View File

@ -106,9 +106,7 @@ protected:
virtual PCompositableParent* AllocPCompositableParent(const TextureInfo& aInfo) MOZ_OVERRIDE;
virtual bool DeallocPCompositableParent(PCompositableParent* actor) MOZ_OVERRIDE;
void Attach(ShadowLayerParent* aLayerParent,
CompositableParent* aCompositable,
bool aIsAsyncVideo);
void Attach(ShadowLayerParent* aLayerParent, CompositableParent* aCompositable);
private:
nsRefPtr<LayerManagerComposite> mLayerManager;