Backout changeset 75419010ac02 (bug 539356) because of performance and correctness regressions

This commit is contained in:
Ehsan Akhgari 2012-07-03 20:31:54 -04:00
parent a8ccbe5fba
commit e275d5ebb0
4 changed files with 20 additions and 12 deletions

View File

@ -229,12 +229,6 @@ public:
virtual ShadowLayerManager* AsShadowManager()
{ return nsnull; }
/**
* Returns true if this LayerManager is owned by an nsIWidget,
* and is used for drawing into the widget.
*/
virtual bool IsWidgetLayerManager() { return true; }
/**
* Start a new transaction. Nested transactions are not allowed so
* there must be no transaction currently in progress.

View File

@ -93,7 +93,9 @@ ToInsideIntRect(const gfxRect& aRect)
}
BasicLayerManager::BasicLayerManager(nsIWidget* aWidget) :
#ifdef DEBUG
mPhase(PHASE_NONE),
#endif
mWidget(aWidget)
, mDoubleBuffering(BUFFER_NONE), mUsingDefaultTarget(false)
, mCachedSurfaceInUse(false)
@ -104,7 +106,9 @@ BasicLayerManager::BasicLayerManager(nsIWidget* aWidget) :
}
BasicLayerManager::BasicLayerManager() :
#ifdef DEBUG
mPhase(PHASE_NONE),
#endif
mWidget(nsnull)
, mDoubleBuffering(BUFFER_NONE), mUsingDefaultTarget(false)
, mCachedSurfaceInUse(false)
@ -195,7 +199,9 @@ BasicLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
#endif
NS_ASSERTION(!InTransaction(), "Nested transactions not allowed");
#ifdef DEBUG
mPhase = PHASE_CONSTRUCTION;
#endif
mTarget = aTarget;
}
@ -388,7 +394,9 @@ BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback,
#endif
NS_ASSERTION(InConstruction(), "Should be in construction phase");
#ifdef DEBUG
mPhase = PHASE_DRAWING;
#endif
Layer* aLayer = GetRoot();
RenderTraceLayers(aLayer, "FF00");
@ -437,9 +445,11 @@ BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback,
MOZ_LAYERS_LOG(("]----- EndTransaction"));
#endif
#ifdef DEBUG
// Go back to the construction phase if the transaction isn't complete.
// Layout will update the layer tree and call EndTransaction().
mPhase = mTransactionIncomplete ? PHASE_CONSTRUCTION : PHASE_NONE;
#endif
if (!mTransactionIncomplete) {
// This is still valid if the transaction was incomplete.
@ -985,7 +995,9 @@ void
BasicShadowLayerManager::ForwardTransaction()
{
RenderTraceScope rendertrace("Foward Transaction", "000090");
#ifdef DEBUG
mPhase = PHASE_FORWARD;
#endif
// forward this transaction's changeset to our ShadowLayerManager
AutoInfallibleTArray<EditReply, 10> replies;
@ -1050,7 +1062,9 @@ BasicShadowLayerManager::ForwardTransaction()
NS_WARNING("failed to forward Layers transaction");
}
#ifdef DEBUG
mPhase = PHASE_NONE;
#endif
// this may result in Layers being deleted, which results in
// PLayer::Send__delete__() and DeallocShmem()

View File

@ -86,8 +86,6 @@ public:
nsIWidget* GetRetainerWidget() { return mWidget; }
void ClearRetainerWidget() { mWidget = nsnull; }
virtual bool IsWidgetLayerManager() { return mWidget != nsnull; }
virtual void BeginTransaction();
virtual void BeginTransactionWithTarget(gfxContext* aTarget);
virtual bool EndEmptyTransaction();
@ -123,11 +121,9 @@ public:
bool InConstruction() { return mPhase == PHASE_CONSTRUCTION; }
bool InDrawing() { return mPhase == PHASE_DRAWING; }
bool InForward() { return mPhase == PHASE_FORWARD; }
#endif
bool InTransaction() { return mPhase != PHASE_NONE; }
#endif
gfxContext* GetTarget() { return mTarget; }
void SetTarget(gfxContext* aTarget) { mUsingDefaultTarget = false; mTarget = aTarget; }
bool IsRetained() { return mWidget != nsnull; }
#ifdef MOZ_LAYERS_HAVE_LOG
@ -153,10 +149,12 @@ public:
virtual PRInt32 GetMaxTextureSize() const { return PR_INT32_MAX; }
protected:
#ifdef DEBUG
enum TransactionPhase {
PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD
};
TransactionPhase mPhase;
#endif
// Paints aLayer to mTarget.
void PaintLayer(gfxContext* aTarget,

View File

@ -27,7 +27,9 @@ BasicThebesLayer::CreateBuffer(Buffer::ContentType aType, const nsIntSize& aSize
referenceSurface = defaultTarget->CurrentSurface();
} else {
nsIWidget* widget = BasicManager()->GetRetainerWidget();
if (!widget || !(referenceSurface = widget->GetThebesSurface())) {
if (widget) {
referenceSurface = widget->GetThebesSurface();
} else {
referenceSurface = BasicManager()->GetTarget()->CurrentSurface();
}
}