Bug 918634 - swapFrameLoader not implemented for e10s r=nical

Allow layers to change layermanager if using LayerManagerComposite.

--HG--
extra : rebase_source : f24fde110f91fff7e2ceb3ddcd4549077a15f3c6
This commit is contained in:
David Parks 2014-10-14 15:11:38 -07:00
parent 8990545f80
commit 5b3ab326b6
16 changed files with 106 additions and 5 deletions

View File

@ -2226,7 +2226,15 @@ public:
{
MOZ_ASSERT(!mFirstChild && !mLastChild);
MOZ_ASSERT(!aLayer->GetParent());
MOZ_ASSERT(aLayer->Manager() == Manager());
if (aLayer->Manager() != Manager()) {
// This can happen when e.g. rendering while dragging tabs
// between windows - aLayer's manager may be the manager for the
// old window's tab. In that case, it will be changed before the
// next render (see SetLayerManager). It is simply easier to
// ignore the rendering here than it is to pause it.
NS_WARNING("ConnectReferentLayer failed - Incorrect LayerManager");
return;
}
mFirstChild = mLastChild = aLayer;
aLayer->SetParent(this);
@ -2238,9 +2246,6 @@ public:
*/
void DetachReferentLayer(Layer* aLayer)
{
MOZ_ASSERT(aLayer == mFirstChild && mFirstChild == mLastChild);
MOZ_ASSERT(aLayer->GetParent() == this);
mFirstChild = mLastChild = nullptr;
aLayer->SetParent(nullptr);
}

View File

@ -62,6 +62,16 @@ CanvasLayerComposite::GetLayer()
return this;
}
void
CanvasLayerComposite::SetLayerManager(LayerManagerComposite* aManager)
{
LayerComposite::SetLayerManager(aManager);
mManager = aManager;
if (mImageHost) {
mImageHost->SetCompositor(mCompositor);
}
}
LayerRenderState
CanvasLayerComposite::GetRenderState()
{

View File

@ -49,6 +49,8 @@ public:
Destroy();
}
virtual void SetLayerManager(LayerManagerComposite* aManager) MOZ_OVERRIDE;
virtual Layer* GetLayer() MOZ_OVERRIDE;
virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE;

View File

@ -42,6 +42,12 @@ public:
// LayerComposite Implementation
virtual Layer* GetLayer() MOZ_OVERRIDE { return this; }
virtual void SetLayerManager(LayerManagerComposite* aManager) MOZ_OVERRIDE
{
LayerComposite::SetLayerManager(aManager);
mManager = aManager;
}
virtual void Destroy() MOZ_OVERRIDE { mDestroyed = true; }
virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE;

View File

@ -62,6 +62,17 @@ public:
// LayerComposite Implementation
virtual Layer* GetLayer() MOZ_OVERRIDE { return this; }
virtual void SetLayerManager(LayerManagerComposite* aManager) MOZ_OVERRIDE
{
LayerComposite::SetLayerManager(aManager);
mManager = aManager;
for (Layer* l = GetFirstChild(); l; l = l->GetNextSibling()) {
LayerComposite* child = l->AsLayerComposite();
child->SetLayerManager(aManager);
}
}
virtual void Destroy() MOZ_OVERRIDE;
LayerComposite* GetFirstChildComposite();

View File

@ -14,6 +14,7 @@
#include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
#include "nsISupportsImpl.h" // for TextureImage::AddRef, etc
#include "nscore.h" // for nsACString
#include "CompositableHost.h" // for CompositableHost
struct nsIntPoint;
struct nsIntRect;
@ -21,7 +22,6 @@ struct nsIntRect;
namespace mozilla {
namespace layers {
class CompositableHost;
class ImageHost;
class Layer;
@ -45,6 +45,15 @@ public:
virtual Layer* GetLayer() MOZ_OVERRIDE;
virtual void SetLayerManager(LayerManagerComposite* aManager) MOZ_OVERRIDE
{
LayerComposite::SetLayerManager(aManager);
mManager = aManager;
if (mImageHost) {
mImageHost->SetCompositor(mCompositor);
}
}
virtual void RenderLayer(const nsIntRect& aClipRect);
virtual void ComputeEffectiveTransforms(const mozilla::gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE;

View File

@ -1083,6 +1083,13 @@ LayerManagerComposite::NotifyShadowTreeTransaction()
}
}
void
LayerComposite::SetLayerManager(LayerManagerComposite* aManager)
{
mCompositeManager = aManager;
mCompositor = aManager->GetCompositor();
}
#ifndef MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
/*static*/ bool

View File

@ -352,6 +352,8 @@ public:
virtual Layer* GetLayer() = 0;
virtual void SetLayerManager(LayerManagerComposite* aManager);
/**
* Perform a first pass over the layer tree to render all of the intermediate
* surfaces that we can. This allows us to avoid framebuffer switches in the

View File

@ -85,6 +85,16 @@ PaintedLayerComposite::GetLayer()
return this;
}
void
PaintedLayerComposite::SetLayerManager(LayerManagerComposite* aManager)
{
LayerComposite::SetLayerManager(aManager);
mManager = aManager;
if (mBuffer) {
mBuffer->SetCompositor(mCompositor);
}
}
TiledLayerComposer*
PaintedLayerComposite::GetTiledLayerComposer()
{

View File

@ -53,6 +53,8 @@ public:
virtual Layer* GetLayer() MOZ_OVERRIDE;
virtual void SetLayerManager(LayerManagerComposite* aManager) MOZ_OVERRIDE;
virtual TiledLayerComposer* GetTiledLayerComposer() MOZ_OVERRIDE;
virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE;

View File

@ -371,6 +371,7 @@ BufferTextureHost::SetCompositor(Compositor* aCompositor)
it->SetCompositor(aCompositor);
it = it->GetNextSibling();
}
mFirstSource = nullptr;
mCompositor = aCompositor;
}

View File

@ -215,6 +215,15 @@ public:
return mLowPrecisionTiledBuffer.GetValidRegion();
}
virtual void SetCompositor(Compositor* aCompositor)
{
CompositableHost::SetCompositor(aCompositor);
mTiledBuffer.SetCompositor(aCompositor);
mLowPrecisionTiledBuffer.SetCompositor(aCompositor);
mOldTiledBuffer.SetCompositor(aCompositor);
mOldLowPrecisionTiledBuffer.SetCompositor(aCompositor);
}
virtual bool UseTiledLayerBuffer(ISurfaceAllocator* aAllocator,
const SurfaceDescriptorTiles& aTiledDescriptor) MOZ_OVERRIDE;

View File

@ -1039,6 +1039,19 @@ CompositorParent::NotifyChildCreated(const uint64_t& aChild)
sIndirectLayerTrees[aChild].mLayerManager = mLayerManager;
}
bool
CompositorParent::RecvAdoptChild(const uint64_t& child)
{
NotifyChildCreated(child);
if (sIndirectLayerTrees[child].mLayerTree) {
sIndirectLayerTrees[child].mLayerTree->mLayerManager = mLayerManager;
}
if (sIndirectLayerTrees[child].mRoot) {
sIndirectLayerTrees[child].mRoot->AsLayerComposite()->SetLayerManager(mLayerManager);
}
return true;
}
/*static*/ uint64_t
CompositorParent::AllocateLayerTreeId()
{
@ -1179,6 +1192,7 @@ public:
virtual bool RecvPause() MOZ_OVERRIDE { return true; }
virtual bool RecvResume() MOZ_OVERRIDE { return true; }
virtual bool RecvNotifyChildCreated(const uint64_t& child) MOZ_OVERRIDE;
virtual bool RecvAdoptChild(const uint64_t& child) MOZ_OVERRIDE { return false; }
virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
const nsIntRect& aRect)
{ return true; }

View File

@ -109,6 +109,7 @@ public:
virtual bool RecvPause() MOZ_OVERRIDE;
virtual bool RecvResume() MOZ_OVERRIDE;
virtual bool RecvNotifyChildCreated(const uint64_t& child) MOZ_OVERRIDE;
virtual bool RecvAdoptChild(const uint64_t& child) MOZ_OVERRIDE;
virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
const nsIntRect& aRect) MOZ_OVERRIDE;
virtual bool RecvFlushRendering() MOZ_OVERRIDE;

View File

@ -73,6 +73,7 @@ parent:
sync Resume();
async NotifyChildCreated(uint64_t id);
async AdoptChild(uint64_t id);
// Make a snapshot of the content that would have been drawn to our
// render target at the time this message is received. If the size

View File

@ -73,6 +73,9 @@ already_AddRefed<LayerManager>
GetFrom(nsFrameLoader* aFrameLoader)
{
nsIDocument* doc = aFrameLoader->GetOwnerDoc();
if (!doc) {
return nullptr;
}
return nsContentUtils::LayerManagerForDocument(doc);
}
@ -401,6 +404,14 @@ RenderFrameParent::OwnerContentChanged(nsIContent* aContent)
{
NS_ABORT_IF_FALSE(mFrameLoader->GetOwnerContent() == aContent,
"Don't build new map if owner is same!");
nsRefPtr<LayerManager> lm = GetFrom(mFrameLoader);
// Perhaps the document containing this frame currently has no presentation?
if (lm && lm->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
ClientLayerManager *clientManager =
static_cast<ClientLayerManager*>(lm.get());
clientManager->GetRemoteRenderer()->SendAdoptChild(mLayersId);
}
}
nsEventStatus