Back out cb34d80e6fc8 (bug 889515) for 10.6 assertions

CLOSED TREE
This commit is contained in:
Phil Ringnalda 2013-07-11 21:24:20 -07:00
parent 3cb471612c
commit 881e670d5e
8 changed files with 28 additions and 61 deletions

View File

@ -232,16 +232,6 @@ ClientLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags)
return true;
}
CompositorChild *
ClientLayerManager::GetRemoteRenderer()
{
if (!mWidget) {
return nullptr;
}
return mWidget->GetRemoteRenderer();
}
void
ClientLayerManager::MakeSnapshotIfRequired()
{
@ -249,7 +239,7 @@ ClientLayerManager::MakeSnapshotIfRequired()
return;
}
if (mWidget) {
if (CompositorChild* remoteRenderer = GetRemoteRenderer()) {
if (CompositorChild* remoteRenderer = mWidget->GetRemoteRenderer()) {
nsIntRect bounds;
mWidget->GetBounds(bounds);
SurfaceDescriptor inSnapshot, snapshot;

View File

@ -53,11 +53,6 @@ public:
virtual already_AddRefed<ColorLayer> CreateColorLayer();
virtual already_AddRefed<RefLayer> CreateRefLayer();
virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE
{
return mTextureFactoryIdentifier;
}
virtual void FlushRendering() MOZ_OVERRIDE;
virtual bool NeedsWidgetInvalidation() MOZ_OVERRIDE { return false; }
@ -94,8 +89,6 @@ public:
void* GetThebesLayerCallbackData() const
{ return mThebesLayerCallbackData; }
CompositorChild *GetRemoteRenderer();
/**
* Called for each iteration of a progressive tile update. Fills
* aViewport, aScaleX and aScaleY with the current scale and viewport

View File

@ -40,6 +40,10 @@ public:
typedef gfxASurface::gfxContentType gfxContentType;
CompositableForwarder()
: mMaxTextureSize(0)
, mCompositorBackend(layers::LAYERS_NONE)
, mSupportsTextureBlitting(false)
, mSupportsPartialUploads(false)
{}
/**
@ -146,7 +150,7 @@ public:
/**
* Returns the maximum texture size supported by the compositor.
*/
virtual int32_t GetMaxTextureSize() const { return mTextureFactoryIdentifier.mMaxTextureSize; }
virtual int32_t GetMaxTextureSize() const { return mMaxTextureSize; }
bool IsOnCompositorSide() const MOZ_OVERRIDE { return false; }
@ -157,21 +161,24 @@ public:
*/
LayersBackend GetCompositorBackendType() const
{
return mTextureFactoryIdentifier.mParentBackend;
return mCompositorBackend;
}
bool SupportsTextureBlitting() const
{
return mTextureFactoryIdentifier.mSupportsTextureBlitting;
return mSupportsTextureBlitting;
}
bool SupportsPartialUploads() const
{
return mTextureFactoryIdentifier.mSupportsPartialUploads;
return mSupportsPartialUploads;
}
protected:
TextureFactoryIdentifier mTextureFactoryIdentifier;
uint32_t mMaxTextureSize;
LayersBackend mCompositorBackend;
bool mSupportsTextureBlitting;
bool mSupportsPartialUploads;
};
} // namespace

View File

@ -36,6 +36,7 @@ namespace layers {
// FIXME/bug 774386: we're assuming that there's only one
// CompositorParent, but that's not always true. This assumption only
// affects CrossProcessCompositorParent below.
static CompositorParent* sCurrentCompositor;
static Thread* sCompositorThread = nullptr;
// manual reference count of the compositor thread.
static int sCompositorThreadRefCount = 0;
@ -152,6 +153,9 @@ CompositorParent::CompositorParent(nsIWidget* aWidget,
CompositorLoop()->PostTask(FROM_HERE, NewRunnableFunction(&AddCompositor,
this, &mCompositorID));
if (!sCurrentCompositor) {
sCurrentCompositor = this;
}
++sCompositorThreadRefCount;
}
@ -165,6 +169,9 @@ CompositorParent::~CompositorParent()
{
MOZ_COUNT_DTOR(CompositorParent);
if (this == sCurrentCompositor) {
sCurrentCompositor = NULL;
}
ReleaseCompositorThread();
}
@ -670,19 +677,6 @@ CompositorParent::SetTimeAndSampleAnimations(TimeStamp aTime, bool aIsTesting)
typedef map<uint64_t, CompositorParent::LayerTreeState> LayerTreeMap;
static LayerTreeMap sIndirectLayerTrees;
bool
CompositorParent::RecvNotifyChildCreated(const uint64_t& child)
{
NotifyChildCreated(child);
return true;
}
void
CompositorParent::NotifyChildCreated(uint64_t aChild)
{
sIndirectLayerTrees[aChild].mParent = this;
}
/*static*/ uint64_t
CompositorParent::AllocateLayerTreeId()
{
@ -716,7 +710,7 @@ UpdateControllerForLayersId(uint64_t aLayersId,
// Notify the AsyncPanZoomController about the current compositor so that it
// can request composites off the compositor thread.
aController->SetCompositorParent(sIndirectLayerTrees[aLayersId].mParent);
aController->SetCompositorParent(sCurrentCompositor);
}
/*static*/ void
@ -758,7 +752,6 @@ public:
virtual bool RecvStop() MOZ_OVERRIDE { return true; }
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 RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
SurfaceDescriptor* aOutSnapshot)
{ return true; }
@ -858,7 +851,7 @@ CrossProcessCompositorParent::AllocPLayerTransactionParent(const LayersBackend&
{
MOZ_ASSERT(aId != 0);
nsRefPtr<LayerManager> lm = sIndirectLayerTrees[aId].mParent->GetLayerManager();
nsRefPtr<LayerManager> lm = sCurrentCompositor->GetLayerManager();
*aTextureFactoryIdentifier = lm->GetTextureFactoryIdentifier();
return new LayerTransactionParent(lm->AsLayerManagerComposite(), this, aId);
}
@ -872,13 +865,6 @@ CrossProcessCompositorParent::DeallocPLayerTransactionParent(PLayerTransactionPa
return true;
}
bool
CrossProcessCompositorParent::RecvNotifyChildCreated(const uint64_t& child)
{
sIndirectLayerTrees[child].mParent->NotifyChildCreated(child);
return true;
}
void
CrossProcessCompositorParent::ShadowLayersUpdated(
LayerTransactionParent* aLayerTree,
@ -893,7 +879,7 @@ CrossProcessCompositorParent::ShadowLayersUpdated(
}
UpdateIndirectTree(id, shadowRoot, aTargetConfig, isFirstPaint);
sIndirectLayerTrees[id].mParent->NotifyShadowTreeTransaction();
sCurrentCompositor->NotifyShadowTreeTransaction();
}
void

View File

@ -53,7 +53,6 @@ public:
virtual bool RecvStop() MOZ_OVERRIDE;
virtual bool RecvPause() MOZ_OVERRIDE;
virtual bool RecvResume() MOZ_OVERRIDE;
virtual bool RecvNotifyChildCreated(const uint64_t& child) MOZ_OVERRIDE;
virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
SurfaceDescriptor* aOutSnapshot);
virtual bool RecvFlushRendering() MOZ_OVERRIDE;
@ -75,8 +74,6 @@ public:
LayerManagerComposite* GetLayerManager() { return mLayerManager; }
void NotifyChildCreated(uint64_t aChild);
void AsyncRender();
// Can be called from any thread
@ -155,7 +152,6 @@ public:
struct LayerTreeState {
nsRefPtr<Layer> mRoot;
nsRefPtr<AsyncPanZoomController> mController;
CompositorParent *mParent;
TargetConfig mTargetConfig;
};

View File

@ -43,8 +43,6 @@ parent:
sync Pause();
sync Resume();
async NotifyChildCreated(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
// or format of |inSnapshot| doesn't match our render target,

View File

@ -160,7 +160,10 @@ struct AutoTxnEnd {
void
CompositableForwarder::IdentifyTextureHost(const TextureFactoryIdentifier& aIdentifier)
{
mTextureFactoryIdentifier = aIdentifier;
mMaxTextureSize = aIdentifier.mMaxTextureSize;
mCompositorBackend = aIdentifier.mParentBackend;
mSupportsTextureBlitting = aIdentifier.mSupportsTextureBlitting;
mSupportsPartialUploads = aIdentifier.mSupportsPartialUploads;
}
ShadowLayerForwarder::ShadowLayerForwarder()

View File

@ -26,8 +26,6 @@
#include "nsViewportFrame.h"
#include "RenderFrameParent.h"
#include "mozilla/layers/LayerManagerComposite.h"
#include "mozilla/layers/CompositorChild.h"
#include "ClientLayerManager.h"
typedef nsContentView::ViewConfig ViewConfig;
using namespace mozilla::dom;
@ -604,8 +602,7 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader,
nsRefPtr<LayerManager> lm = GetFrom(mFrameLoader);
// Perhaps the document containing this frame currently has no presentation?
if (lm) {
MOZ_ASSERT(lm->GetBackendType() == LAYERS_CLIENT);
if (lm && lm->AsLayerManagerComposite()) {
*aTextureFactoryIdentifier = lm->GetTextureFactoryIdentifier();
} else {
*aTextureFactoryIdentifier = TextureFactoryIdentifier();
@ -615,9 +612,6 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader,
// Our remote frame will push layers updates to the compositor,
// and we'll keep an indirect reference to that tree.
*aId = mLayersId = CompositorParent::AllocateLayerTreeId();
MOZ_ASSERT(lm && lm->GetBackendType() == LAYERS_CLIENT);
ClientLayerManager *clientManager = static_cast<ClientLayerManager*>(lm.get());
clientManager->GetRemoteRenderer()->SendNotifyChildCreated(mLayersId);
if (aScrollingBehavior == ASYNC_PAN_ZOOM) {
mContentController = new RemoteContentController(this);
mPanZoomController = new AsyncPanZoomController(